AzerothCore 3.3.5a
OpenSource WoW Emulator
Loading...
Searching...
No Matches
Unit Class Referenceabstract

#include "Unit.h"

Inheritance diagram for Unit:
WorldObject Object WorldLocation Position Creature Player TempSummon Minion Guardian Puppet Totem Pet

Public Types

typedef std::unordered_set< Unit * > AttackerSet
 
typedef std::set< Unit * > ControlSet
 
typedef std::multimap< uint32, Aura * > AuraMap
 
typedef std::pair< AuraMap::const_iterator, AuraMap::const_iterator > AuraMapBounds
 
typedef std::pair< AuraMap::iterator, AuraMap::iterator > AuraMapBoundsNonConst
 
typedef std::multimap< uint32, AuraApplication * > AuraApplicationMap
 
typedef std::pair< AuraApplicationMap::const_iterator, AuraApplicationMap::const_iterator > AuraApplicationMapBounds
 
typedef std::pair< AuraApplicationMap::iterator, AuraApplicationMap::iterator > AuraApplicationMapBoundsNonConst
 
typedef std::multimap< AuraStateType, AuraApplication * > AuraStateAurasMap
 
typedef std::pair< AuraStateAurasMap::const_iterator, AuraStateAurasMap::const_iterator > AuraStateAurasMapBounds
 
typedef std::vector< AuraEffect * > AuraEffectList
 
typedef std::list< Aura * > AuraList
 
typedef std::list< AuraApplication * > AuraApplicationList
 
typedef std::vector< std::pair< uint8, AuraApplication * > > AuraApplicationProcContainer
 
typedef std::list< DiminishingReturnDiminishing
 
typedef GuidUnorderedSet ComboPointHolderSet
 
typedef std::map< uint8, AuraApplication * > VisibleAuraMap
 
typedef std::set< PetAura const * > PetAuraSet
 

Public Member Functions

 ~Unit () override
 
void Update (uint32 time) override
 
UnitAIGetAI ()
 
void SetAI (UnitAI *newAI)
 
void AddToWorld () override
 
void RemoveFromWorld () override
 
void CleanupBeforeRemoveFromMap (bool finalCleanup)
 
void CleanupsBeforeDelete (bool finalCleanup=true) override
 
virtual bool isBeingLoaded () const
 
bool IsDuringRemoveFromWorld () const
 
void SetUInt32Value (uint16 index, uint32 value)
 
UnitGetOwner () const
 
ObjectGuid GetOwnerGUID () const
 
void SetOwnerGUID (ObjectGuid owner)
 
ObjectGuid GetCreatorGUID () const
 
void SetCreatorGUID (ObjectGuid creator)
 
ObjectGuid GetMinionGUID () const
 
void SetMinionGUID (ObjectGuid guid)
 
ObjectGuid GetCharmerGUID () const
 
void SetCharmerGUID (ObjectGuid owner)
 
ObjectGuid GetCharmGUID () const
 
void SetPetGUID (ObjectGuid guid)
 
ObjectGuid GetPetGUID () const
 
void SetCritterGUID (ObjectGuid guid)
 
ObjectGuid GetCritterGUID () const
 
ObjectGuid GetTransGUID () const override
 
PetToPet ()
 
TotemToTotem ()
 
TempSummonToTempSummon ()
 
const TempSummonToTempSummon () const
 
void AddUnitState (uint32 f)
 
bool HasUnitState (const uint32 f) const
 
void ClearUnitState (uint32 f)
 
uint32 GetUnitState () const
 
uint32 HasUnitTypeMask (uint32 mask) const
 
void AddUnitTypeMask (uint32 mask)
 
uint32 GetUnitTypeMask () const
 
UnitFlags GetUnitFlags () const
 
bool HasUnitFlag (UnitFlags flags) const
 
void SetUnitFlag (UnitFlags flags)
 UnitFlags available in UnitDefines.h.
 
void RemoveUnitFlag (UnitFlags flags)
 UnitFlags available in UnitDefines.h.
 
void ReplaceAllUnitFlags (UnitFlags flags)
 Remove the Unit flag specify only.
 
UnitFlags2 GetUnitFlags2 () const
 Remove all UnitFlags and set new ones. UnitFlags available in UnitDefines.h.
 
bool HasUnitFlag2 (UnitFlags2 flags) const
 
void SetUnitFlag2 (UnitFlags2 flags)
 
void RemoveUnitFlag2 (UnitFlags2 flags)
 
void ReplaceAllUnitFlags2 (UnitFlags2 flags)
 
void SetEmoteState (Emote emoteState)
 
void ClearEmoteState ()
 Sets emote state (looping emote). Emotes available in SharedDefines.h.
 
NPCFlags GetNpcFlags () const
 Clears emote state (looping emote)
 
bool HasNpcFlag (NPCFlags flags) const
 
void SetNpcFlag (NPCFlags flags)
 
void RemoveNpcFlag (NPCFlags flags)
 
void ReplaceAllNpcFlags (NPCFlags flags)
 
uint32 GetDynamicFlags () const override
 
void ReplaceAllDynamicFlags (uint32 flag) override
 
void AddUnitMovementFlag (uint32 f)
 
void RemoveUnitMovementFlag (uint32 f)
 
bool HasUnitMovementFlag (uint32 f) const
 
uint32 GetUnitMovementFlags () const
 
void SetUnitMovementFlags (uint32 f)
 
void AddExtraUnitMovementFlag (uint16 f)
 
void RemoveExtraUnitMovementFlag (uint16 f)
 
uint16 HasExtraUnitMovementFlag (uint16 f) const
 
uint16 GetExtraUnitMovementFlags () const
 
void SetExtraUnitMovementFlags (uint16 f)
 
bool IsCrowdControlled () const
 
bool IsImmobilizedState () const
 
void SetAnimTier (AnimTier animTier)
 
bool IsSummon () const
 
bool IsGuardian () const
 
bool IsControllableGuardian () const
 
bool IsPet () const
 
bool IsHunterPet () const
 
bool IsTotem () const
 
bool IsVehicle () const
 
bool IsVendor () const
 
bool IsTrainer () const
 
bool IsQuestGiver () const
 
bool IsGossip () const
 
bool IsTaxi () const
 
bool IsGuildMaster () const
 
bool IsBattleMaster () const
 
bool IsBanker () const
 
bool IsInnkeeper () const
 
bool IsSpiritHealer () const
 
bool IsSpiritGuide () const
 
bool IsTabardDesigner () const
 
bool IsAuctioner () const
 
bool IsArmorer () const
 
bool IsServiceProvider () const
 
bool IsSpiritService () const
 
uint32 GetCreatureType () const
 
uint32 GetCreatureTypeMask () const
 
bool IsCritter () const
 
uint8 getRace (bool original=false) const
 
void setRace (uint8 race)
 
uint32 getRaceMask () const
 
DisplayRace GetDisplayRaceFromModelId (uint32 modelId) const
 
DisplayRace GetDisplayRace () const
 
uint8 getClass () const
 
virtual bool IsClass (Classes unitClass, ClassContext context=CLASS_CONTEXT_NONE) const
 
uint32 getClassMask () const
 
uint8 getGender () const
 
uint32 GetFaction () const
 
FactionTemplateEntry const * GetFactionTemplateEntry () const
 
void SetFaction (uint32 faction)
 
void RestoreFaction ()
 
uint32 GetOldFactionId () const
 
ObjectGuid GetTarget () const
 
virtual void SetTarget (ObjectGuid=ObjectGuid::Empty)=0
 
bool isTargetableForAttack (bool checkFakeDeath=true, Unit const *byWho=nullptr) const
 
bool IsValidAttackTarget (Unit const *target, SpellInfo const *bySpell=nullptr) const
 
bool _IsValidAttackTarget (Unit const *target, SpellInfo const *bySpell, WorldObject const *obj=nullptr) const
 
bool IsValidAssistTarget (Unit const *target) const
 
bool _IsValidAssistTarget (Unit const *target, SpellInfo const *bySpell) const
 
bool IsClientControlled (Player const *exactClient=nullptr) const
 
Player const * GetClientControlling () const
 
float GetBoundaryRadius () const
 
float GetCombatReach () const override
 
float GetMeleeReach () const
 
bool IsWithinRange (Unit const *obj, float dist) const
 
bool IsWithinBoundaryRadius (const Unit *obj) const
 
bool IsWithinCombatRange (Unit const *obj, float dist2compare) const
 
bool IsWithinMeleeRange (Unit const *obj, float dist=0.f) const
 
float GetMeleeRange (Unit const *target) const
 
void setAttackTimer (WeaponAttackType type, int32 time)
 
void resetAttackTimer (WeaponAttackType type=BASE_ATTACK)
 
int32 getAttackTimer (WeaponAttackType type) const
 
bool isAttackReady (WeaponAttackType type=BASE_ATTACK) const
 
virtual SpellSchoolMask GetMeleeDamageSchoolMask (WeaponAttackType attackType=BASE_ATTACK, uint8 damageIndex=0) const =0
 
bool GetRandomContactPoint (Unit const *target, float &x, float &y, float &z, bool force=false) const
 
UnitgetAttackerForHelper () const
 
bool Attack (Unit *victim, bool meleeAttack)
 
void CastStop (uint32 except_spellid=0, bool withInstant=true)
 Interrupt the unit cast for all the current spells.
 
bool AttackStop ()
 Force the unit to stop attacking. This will clear UNIT_STATE_MELEE_ATTACKING, Interrupt current spell, AI assistance, and call SendMeleeAttackStop() to the client.
 
void RemoveAllAttackers ()
 Remove all units in m_attackers list and send them AttackStop()
 
AttackerSet const & getAttackers () const
 
bool GetMeleeAttackPoint (Unit *attacker, Position &pos)
 
bool isAttackingPlayer () const
 
UnitGetVictim () const
 
void CombatStop (bool includingCast=false)
 
void CombatStopWithPets (bool includingCast=false)
 
void StopAttackFaction (uint32 faction_id)
 
void StopAttackingInvalidTarget ()
 
UnitSelectNearbyTarget (Unit *exclude=nullptr, float dist=NOMINAL_MELEE_RANGE) const
 
UnitSelectNearbyNoTotemTarget (Unit *exclude=nullptr, float dist=NOMINAL_MELEE_RANGE) const
 
void SendMeleeAttackStop (Unit *victim=nullptr)
 Send to the client SMSG_ATTACKSTOP but doesn't clear UNIT_STATE_MELEE_ATTACKING on server side or interrupt spells. Unless you know exactly what you're doing, use AttackStop() or RemoveAllAttackers() instead.
 
void SendMeleeAttackStart (Unit *victim, Player *sendTo=nullptr)
 
uint32 GetAttackTime (WeaponAttackType att) const
 
void SetAttackTime (WeaponAttackType att, uint32 val)
 
void ApplyAttackTimePercentMod (WeaponAttackType att, float val, bool apply)
 
void ApplyCastTimePercentMod (float val, bool apply)
 
void SetImmuneToAll (bool apply, bool keepCombat=false)
 
bool IsImmuneToAll () const
 
void SetImmuneToPC (bool apply, bool keepCombat=false)
 
bool IsImmuneToPC () const
 
void SetImmuneToNPC (bool apply, bool keepCombat=false)
 
bool IsImmuneToNPC () const
 
bool IsEngaged () const
 
bool IsEngagedBy (Unit const *who) const
 
bool IsInCombat () const
 
bool IsInCombatWith (Unit const *who) const
 
bool IsPetInCombat () const
 
void CombatStart (Unit *target, bool initialAggro=true)
 
void CombatStartOnCast (Unit *target, bool initialAggro=true, uint32 duration=0)
 
void SetInCombatState (bool PvP, Unit *enemy=nullptr, uint32 duration=0)
 
void SetInCombatWith (Unit *enemy, uint32 duration=0)
 
void ClearInCombat ()
 
void ClearInPetCombat ()
 
uint32 GetCombatTimer () const
 
void SetCombatTimer (uint32 timer)
 
bool CanHaveThreatList (bool skipAliveCheck=false) const
 
void AddThreat (Unit *victim, float fThreat, SpellSchoolMask schoolMask=SPELL_SCHOOL_MASK_NORMAL, SpellInfo const *threatSpell=nullptr)
 
float ApplyTotalThreatModifier (float fThreat, SpellSchoolMask schoolMask=SPELL_SCHOOL_MASK_NORMAL)
 
void TauntApply (Unit *victim)
 
void TauntFadeOut (Unit *taunter)
 
ThreatMgrGetThreatMgr ()
 
ThreatMgr const & GetThreatMgr () const
 
void addHatedBy (HostileReference *pHostileReference)
 
void removeHatedBy (HostileReference *)
 
HostileRefMgrgetHostileRefMgr ()
 
void SetRedirectThreat (ObjectGuid guid, uint32 pct)
 
void ResetRedirectThreat ()
 
void ModifyRedirectThreat (int32 amount)
 
uint32 GetRedirectThreatPercent ()
 
UnitGetRedirectThreatTarget () const
 
void SetLastDamagedTargetGuid (ObjectGuid const &guid)
 
ObjectGuid const & GetLastDamagedTargetGuid () const
 
void AttackerStateUpdate (Unit *victim, WeaponAttackType attType=BASE_ATTACK, bool extra=false, bool ignoreCasting=false)
 
bool haveOffhandWeapon () const
 
bool CanDualWield () const
 
virtual void SetCanDualWield (bool value)
 
virtual void SetDualWieldMode (DualWieldMode mode)
 
virtual bool HasWeapon (WeaponAttackType type) const =0
 
bool HasMainhandWeapon () const
 
bool HasOffhandWeapon () const
 
bool HasRangedWeapon () const
 
bool hasMainhandWeaponForAttack () const
 
virtual bool HasWeaponForAttack (WeaponAttackType type) const
 
bool HasMainhandWeaponForAttack () const
 
bool HasOffhandWeaponForAttack () const
 
bool HasRangedWeaponForAttack () const
 
bool CanUseAttackType (WeaponAttackType attacktype) const
 
void HandleProcExtraAttackFor (Unit *victim, uint32 count)
 
void SetLastExtraAttackSpell (uint32 spellId)
 
uint32 GetLastExtraAttackSpell () const
 
void AddExtraAttacks (uint32 count)
 
uint8 GetComboPoints (Unit const *who=nullptr) const
 
uint8 GetComboPoints (ObjectGuid const &guid) const
 
UnitGetComboTarget () const
 
ObjectGuid const GetComboTargetGUID () const
 
void AddComboPoints (Unit *target, int8 count)
 
void AddComboPoints (int8 count)
 
void ClearComboPoints ()
 
void AddComboPointHolder (Unit *unit)
 
void RemoveComboPointHolder (Unit *unit)
 
void ClearComboPointHolders ()
 
void SetContestedPvP (Player *attackedPlayer=nullptr, bool lookForNearContestedGuards=true)
 
bool IsContestedGuard () const
 
bool RespondsToCallForHelp () const
 
bool IsInSanctuary () const
 
bool IsPvP () const
 
bool IsFFAPvP () const
 
void SetPvP (bool state)
 
float GetStat (Stats stat) const
 
void SetStat (Stats stat, int32 val)
 
Stats GetStatByAuraGroup (UnitMods unitMod) const
 
float GetCreateStat (Stats stat) const
 
void SetCreateStat (Stats stat, float val)
 
float GetPosStat (Stats stat) const
 
float GetNegStat (Stats stat) const
 
void InitStatBuffMods ()
 
bool HandleStatFlatModifier (UnitMods unitMod, UnitModifierFlatType modifierType, float amount, bool apply)
 
void ApplyStatPctModifier (UnitMods unitMod, UnitModifierPctType modifierType, float amount)
 
void SetStatFlatModifier (UnitMods unitMod, UnitModifierFlatType modifierType, float val)
 
void SetStatPctModifier (UnitMods unitMod, UnitModifierPctType modifierType, float val)
 
float GetFlatModifierValue (UnitMods unitMod, UnitModifierFlatType modifierType) const
 
float GetPctModifierValue (UnitMods unitMod, UnitModifierPctType modifierType) const
 
void UpdateUnitMod (UnitMods unitMod)
 
virtual bool CheckAttackFitToAuraRequirement (WeaponAttackType, AuraEffect const *) const
 
virtual void UpdateDamageDoneMods (WeaponAttackType attackType, int32 skipEnchantSlot=-1)
 
void UpdateAllDamageDoneMods ()
 
void UpdateDamagePctDoneMods (WeaponAttackType attackType)
 
void UpdateAllDamagePctDoneMods ()
 
float GetTotalStatValue (Stats stat, float additionalValue=0.0f) const
 
void SetCanModifyStats (bool modifyStats)
 
bool CanModifyStats () const
 
void UpdateStatBuffMod (Stats stat)
 
uint8 GetLevel () const
 
uint8 getLevelForTarget (WorldObject const *) const override
 
void SetLevel (uint8 lvl, bool showLevelChange=true)
 
uint32 GetHealth () const
 
uint32 GetMaxHealth () const
 
float GetHealthPct () const
 
int32 GetHealthGain (int32 dVal)
 
uint32 GetCreateHealth () const
 
bool IsFullHealth () const
 
bool HealthBelowPct (int32 pct) const
 
bool HealthBelowPctDamaged (int32 pct, uint32 damage) const
 
bool HealthAbovePct (int32 pct) const
 
bool HealthAbovePctHealed (int32 pct, uint32 heal) const
 
uint32 CountPctFromMaxHealth (int32 pct) const
 
uint32 CountPctFromCurHealth (int32 pct) const
 
void SetHealth (uint32 val)
 
void SetMaxHealth (uint32 val)
 
void SetFullHealth ()
 
int32 ModifyHealth (int32 val)
 
void SetCreateHealth (uint32 val)
 
Powers getPowerType () const
 
virtual bool HasActivePowerType (Powers power)
 
Powers GetPowerTypeByAuraGroup (UnitMods unitMod) const
 
uint32 GetPower (Powers power) const
 
uint32 GetMaxPower (Powers power) const
 
float GetPowerPct (Powers power) const
 
uint32 GetCreatePowers (Powers power) const
 
void setPowerType (Powers power)
 
void SetPower (Powers power, uint32 val, bool withPowerUpdate=true, bool fromRegenerate=false)
 
void SetMaxPower (Powers power, uint32 val)
 
int32 ModifyPower (Powers power, int32 val, bool withPowerUpdate=true)
 
void RewardRage (uint32 damage, uint32 weaponSpeedHitFactor, bool attacker)
 
uint32 GetCreateMana () const
 
void SetCreateMana (uint32 val)
 
bool CanRestoreMana (SpellInfo const *spellInfo) const
 
void SetLastManaUse (uint32 spellCastTime)
 
bool IsUnderLastManaUseEffect () const
 
float GetAPMultiplier (WeaponAttackType attType, bool normalized)
 
uint32 GetArmor () const
 
void SetArmor (int32 val)
 
float GetUnitDodgeChance () const
 
float GetUnitParryChance () const
 
float GetUnitBlockChance () const
 
float GetUnitMissChance (WeaponAttackType attType) const
 
float GetUnitCriticalChance (WeaponAttackType attackType, Unit const *victim) const
 
MeleeHitOutcome RollMeleeOutcomeAgainst (Unit const *victim, WeaponAttackType attType) const
 
MeleeHitOutcome RollMeleeOutcomeAgainst (Unit const *victim, WeaponAttackType attType, int32 crit_chance, int32 miss_chance, int32 dodge_chance, int32 parry_chance, int32 block_chance) const
 
bool CanApplyResilience () const
 
virtual uint32 GetShieldBlockValue () const =0
 
uint32 GetShieldBlockValue (uint32 soft_cap, uint32 hard_cap) const
 
uint32 GetUnitMeleeSkill (Unit const *target=nullptr) const
 
uint32 GetDefenseSkillValue (Unit const *target=nullptr) const
 
uint32 GetWeaponSkillValue (WeaponAttackType attType, Unit const *target=nullptr) const
 
int32 GetMechanicResistChance (SpellInfo const *spell)
 
uint32 GetResistance (SpellSchoolMask mask) const
 
uint32 GetResistance (SpellSchools school) const
 
void SetResistance (SpellSchools school, int32 val)
 
void UpdateResistanceBuffModsMod (SpellSchools school)
 
uint16 GetMaxSkillValueForLevel (Unit const *target=nullptr) const
 
float GetTotalAuraModValue (UnitMods unitMod) const
 
SpellSchools GetSpellSchoolByAuraGroup (UnitMods unitMod) const
 
float GetTotalAttackPowerValue (WeaponAttackType attType, Unit *pVictim=nullptr) const
 
float GetWeaponDamageRange (WeaponAttackType attType, WeaponDamageRange type, uint8 damageIndex=0) const
 
void SetBaseWeaponDamage (WeaponAttackType attType, WeaponDamageRange damageRange, float value, uint8 damageIndex=0)
 
virtual bool UpdateStats (Stats stat)=0
 
virtual bool UpdateAllStats ()=0
 
virtual void UpdateResistances (uint32 school)=0
 
virtual void UpdateAllResistances ()
 
virtual void UpdateArmor ()=0
 
virtual void UpdateMaxHealth ()=0
 
virtual void UpdateMaxPower (Powers power)=0
 
virtual void UpdateAttackPowerAndDamage (bool ranged=false)=0
 
virtual void UpdateDamagePhysical (WeaponAttackType attType)
 
void DealMeleeDamage (CalcDamageInfo *damageInfo, bool durabilityLoss)
 
void DealSpellDamage (SpellNonMeleeDamage *damageInfo, bool durabilityLoss, Spell const *spell=nullptr)
 
void DealDamageShieldDamage (Unit *victim)
 
void KillSelf (bool durabilityLoss=true, WeaponAttackType attackType=BASE_ATTACK, SpellInfo const *spellProto=nullptr, Spell const *spell=nullptr)
 
uint32 CalculateDamage (WeaponAttackType attType, bool normalized, bool addTotalPct, uint8 itemDamagesMask=0)
 
virtual void CalculateMinMaxDamage (WeaponAttackType attType, bool normalized, bool addTotalPct, float &minDamage, float &maxDamage, uint8 damageIndex=0)=0
 
void CalculateMeleeDamage (Unit *victim, CalcDamageInfo *damageInfo, WeaponAttackType attackType=BASE_ATTACK, const bool sittingVictim=false)
 
void CalculateSpellDamageTaken (SpellNonMeleeDamage *damageInfo, int32 damage, SpellInfo const *spellInfo, WeaponAttackType attackType=BASE_ATTACK, bool crit=false)
 
int32 CalculateSpellDamage (Unit const *target, SpellInfo const *spellProto, uint8 effect_index, int32 const *basePoints=nullptr) const
 
float CalculateDefaultCoefficient (SpellInfo const *spellInfo, DamageEffectType damagetype) const
 
uint32 MeleeDamageBonusDone (Unit *pVictim, uint32 damage, WeaponAttackType attType, SpellInfo const *spellProto=nullptr, SpellSchoolMask damageSchoolMask=SPELL_SCHOOL_MASK_NORMAL)
 
uint32 MeleeDamageBonusTaken (Unit *attacker, uint32 pdamage, WeaponAttackType attType, SpellInfo const *spellProto=nullptr, SpellSchoolMask damageSchoolMask=SPELL_SCHOOL_MASK_NORMAL)
 
int32 SpellBaseDamageBonusDone (SpellSchoolMask schoolMask)
 
int32 SpellBaseDamageBonusTaken (SpellSchoolMask schoolMask, bool isDoT=false)
 
float SpellPctDamageModsDone (Unit *victim, SpellInfo const *spellProto, DamageEffectType damagetype)
 
uint32 SpellDamageBonusDone (Unit *victim, SpellInfo const *spellProto, uint32 pdamage, DamageEffectType damagetype, uint8 effIndex, float TotalMod=0.0f, uint32 stack=1)
 
uint32 SpellDamageBonusTaken (Unit *caster, SpellInfo const *spellProto, uint32 pdamage, DamageEffectType damagetype, uint32 stack=1)
 
int32 CalculateAOEDamageReduction (int32 damage, uint32 schoolMask, bool npcCaster) const
 
uint32 GetMeleeDamageReduction (uint32 damage) const
 
uint32 GetRangedDamageReduction (uint32 damage) const
 
uint32 GetSpellDamageReduction (uint32 damage) const
 
float GetMeleeCritChanceReduction () const
 
float GetRangedCritChanceReduction () const
 
float GetSpellCritChanceReduction () const
 
uint32 GetMeleeCritDamageReduction (uint32 damage) const
 
uint32 GetRangedCritDamageReduction (uint32 damage) const
 
uint32 GetSpellCritDamageReduction (uint32 damage) const
 
CharmInfoGetCharmInfo ()
 
CharmInfoInitCharmInfo ()
 
UnitGetCharmer () const
 
UnitGetCharm () const
 
UnitGetCharmerOrOwner () const
 
UnitGetCharmerOrOwnerOrSelf () const
 
PlayerGetCharmerOrOwnerPlayerOrPlayerItself () const
 
ObjectGuid GetCharmerOrOwnerGUID () const
 
ObjectGuid GetCharmerOrOwnerOrOwnGUID () const
 
PlayerGetAffectingPlayer () const
 
UnitGetFirstControlled () const
 
bool IsControlledByPlayer () const
 
bool IsCreatedByPlayer () const
 
bool IsCharmedOwnedByPlayerOrPlayer () const
 
bool IsCharmed () const
 
bool isPossessed () const
 
bool isPossessedByPlayer () const
 
bool isPossessing () const
 
bool isPossessing (Unit *u) const
 
void SetCharm (Unit *target, bool apply)
 
bool SetCharmedBy (Unit *charmer, CharmType type, AuraApplication const *aurApp=nullptr)
 
void UpdateCharmAI ()
 
void RemoveCharmedBy (Unit *charmer)
 
void RemoveCharmAuras ()
 
void RemoveAllControlled (bool onDeath=false)
 
void DeleteCharmInfo ()
 
virtual bool HasSpellCooldown (uint32) const
 
virtual bool HasSpellItemCooldown (uint32, uint32) const
 
virtual void AddSpellCooldown (uint32, uint32, uint32, bool needSendToClient=false, bool forceSendToSpectator=false)
 
void BuildCooldownPacket (WorldPacket &data, uint8 flags, uint32 spellId, uint32 cooldown)
 
void BuildCooldownPacket (WorldPacket &data, uint8 flags, PacketCooldowns const &cooldowns)
 
AuraAddAura (uint32 spellId, Unit *target)
 
AuraAddAura (SpellInfo const *spellInfo, uint8 effMask, Unit *target)
 
void SetAuraStack (uint32 spellId, Unit *target, uint32 stack)
 
int32 GetHighestExclusiveSameEffectSpellGroupValue (AuraEffect const *aurEff, AuraType auraType, bool checkMiscValue=false, int32 miscValue=0) const
 
bool IsHighestExclusiveAura (Aura const *aura, bool removeOtherAuraApplications=false)
 
bool IsHighestExclusiveAuraEffect (SpellInfo const *spellInfo, AuraType auraType, int32 effectAmount, uint8 auraEffectMask, bool removeOtherAuraApplications=false)
 
Aura_TryStackingOrRefreshingExistingAura (SpellInfo const *newAura, uint8 effMask, Unit *caster, int32 *baseAmount=nullptr, Item *castItem=nullptr, ObjectGuid casterGUID=ObjectGuid::Empty, bool periodicReset=false)
 
void _AddAura (UnitAura *aura, Unit *caster)
 
AuraApplication_CreateAuraApplication (Aura *aura, uint8 effMask)
 
void _ApplyAuraEffect (Aura *aura, uint8 effIndex)
 
void _ApplyAura (AuraApplication *aurApp, uint8 effMask)
 
void _UnapplyAura (AuraApplicationMap::iterator &i, AuraRemoveMode removeMode)
 
void _UnapplyAura (AuraApplication *aurApp, AuraRemoveMode removeMode)
 
void _RemoveNoStackAuraApplicationsDueToAura (Aura *aura)
 
void _RemoveNoStackAurasDueToAura (Aura *aura, bool owned)
 
bool _IsNoStackAuraDueToAura (Aura *appliedAura, Aura *existingAura) const
 
void _RegisterAuraEffect (AuraEffect *aurEff, bool apply)
 
AuraMapGetOwnedAuras ()
 
AuraMap const & GetOwnedAuras () const
 
void RemoveOwnedAura (AuraMap::iterator &i, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
 
void RemoveOwnedAura (uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, uint8 reqEffMask=0, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
 
void RemoveOwnedAura (Aura *aura, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
 
AuraGetOwnedAura (uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint8 reqEffMask=0, Aura *except=nullptr) const
 
AuraApplicationMapGetAppliedAuras ()
 
AuraApplicationMap const & GetAppliedAuras () const
 
void RemoveAura (AuraApplicationMap::iterator &i, AuraRemoveMode mode=AURA_REMOVE_BY_DEFAULT)
 
void RemoveAura (uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, uint8 reqEffMask=0, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
 
void RemoveAura (AuraApplication *aurApp, AuraRemoveMode mode=AURA_REMOVE_BY_DEFAULT)
 
void RemoveAura (Aura *aur, AuraRemoveMode mode=AURA_REMOVE_BY_DEFAULT)
 
void RemoveBindSightAuras ()
 
void RemoveAppliedAuras (std::function< bool(AuraApplication const *)> const &check)
 
void RemoveOwnedAuras (std::function< bool(Aura const *)> const &check)
 
void RemoveAppliedAuras (uint32 spellId, std::function< bool(AuraApplication const *)> const &check)
 
void RemoveOwnedAuras (uint32 spellId, std::function< bool(Aura const *)> const &check)
 
void RemoveAurasDueToSpell (uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, uint8 reqEffMask=0, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
 
void RemoveAuraFromStack (uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
 
void RemoveAurasDueToSpellByDispel (uint32 spellId, uint32 dispellerSpellId, ObjectGuid casterGUID, Unit *dispeller, uint8 chargesRemoved=1)
 
void RemoveAurasDueToSpellBySteal (uint32 spellId, ObjectGuid casterGUID, Unit *stealer)
 
void RemoveAurasDueToItemSpell (uint32 spellId, ObjectGuid castItemGuid)
 
void RemoveAurasByType (AuraType auraType, ObjectGuid casterGUID=ObjectGuid::Empty, Aura *except=nullptr, bool negative=true, bool positive=true)
 
void RemoveNotOwnSingleTargetAuras ()
 
void RemoveAurasWithInterruptFlags (uint32 flag, uint32 except=0, bool isAutoshot=false)
 
void RemoveAurasWithAttribute (uint32 flags)
 
void RemoveAurasWithFamily (SpellFamilyNames family, uint32 familyFlag1, uint32 familyFlag2, uint32 familyFlag3, ObjectGuid casterGUID)
 
void RemoveAurasWithMechanic (uint32 mechanic_mask, AuraRemoveMode removemode=AURA_REMOVE_BY_DEFAULT, uint32 except=0)
 
void RemoveMovementImpairingAuras (bool withRoot)
 
void RemoveAurasByShapeShift ()
 
void RemoveAreaAurasDueToLeaveWorld ()
 
void RemoveAllAuras ()
 
void RemoveArenaAuras ()
 
void RemoveAllAurasOnDeath ()
 
void RemoveAllAurasRequiringDeadTarget ()
 
void RemoveAllAurasExceptType (AuraType type)
 
void RemoveEvadeAuras ()
 
void DelayOwnedAuras (uint32 spellId, ObjectGuid caster, int32 delaytime)
 
void _RemoveAllAuraStatMods ()
 
void _ApplyAllAuraStatMods ()
 
AuraEffectList const & GetAuraEffectsByType (AuraType type) const
 
AuraListGetSingleCastAuras ()
 
AuraList const & GetSingleCastAuras () const
 
AuraEffectGetAuraEffect (uint32 spellId, uint8 effIndex, ObjectGuid casterGUID=ObjectGuid::Empty) const
 
AuraEffectGetAuraEffectOfRankedSpell (uint32 spellId, uint8 effIndex, ObjectGuid casterGUID=ObjectGuid::Empty) const
 
AuraEffectGetAuraEffect (AuraType type, SpellFamilyNames name, uint32 iconId, uint8 effIndex) const
 
AuraEffectGetAuraEffect (AuraType type, SpellFamilyNames family, uint32 familyFlag1, uint32 familyFlag2, uint32 familyFlag3, ObjectGuid casterGUID=ObjectGuid::Empty) const
 
AuraEffectGetAuraEffectDummy (uint32 spellid) const
 
AuraEffectGetDummyAuraEffect (SpellFamilyNames name, uint32 iconId, uint8 effIndex) const
 
AuraApplicationGetAuraApplication (uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint8 reqEffMask=0, AuraApplication *except=nullptr) const
 
AuraGetAura (uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint8 reqEffMask=0) const
 
AuraApplicationGetAuraApplicationOfRankedSpell (uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint8 reqEffMask=0, AuraApplication *except=nullptr) const
 
AuraGetAuraOfRankedSpell (uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint8 reqEffMask=0) const
 
void GetDispellableAuraList (Unit *caster, uint32 dispelMask, DispelChargesList &dispelList, SpellInfo const *dispelSpell)
 
bool HasAuraEffect (uint32 spellId, uint8 effIndex, ObjectGuid caster=ObjectGuid::Empty) const
 
uint32 GetAuraCount (uint32 spellId) const
 
bool HasAuras (SearchMethod sm, std::vector< uint32 > &spellIds) const
 Check if unit has ANY or ALL specified auras.
 
template<typename... Auras>
bool HasAnyAuras (Auras... spellIds) const
 Checks if the unit has ANY specified auras.
 
template<typename... Auras>
bool HasAllAuras (Auras... spellIds) const
 Checks if the unit has ALL specified auras.
 
bool HasAura (uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint8 reqEffMask=0) const
 
bool HasAuraType (AuraType auraType) const
 
bool HasAuraTypeWithCaster (AuraType auratype, ObjectGuid caster) const
 
bool HasAuraTypeWithMiscvalue (AuraType auratype, int32 miscvalue) const
 
bool HasAuraTypeWithAffectMask (AuraType auratype, SpellInfo const *affectedSpell) const
 
bool HasAuraTypeWithValue (AuraType auratype, int32 value) const
 
bool HasAuraTypeWithTriggerSpell (AuraType auratype, uint32 triggerSpell) const
 
bool HasNegativeAuraWithInterruptFlag (uint32 flag, ObjectGuid guid=ObjectGuid::Empty)
 
bool HasVisibleAuraType (AuraType auraType) const
 
bool HasNegativeAuraWithAttribute (uint32 flag, ObjectGuid guid=ObjectGuid::Empty)
 
bool HasAuraWithMechanic (uint32 mechanicMask) const
 
bool HasAuraTypeWithFamilyFlags (AuraType auraType, uint32 familyName, uint32 familyFlags) const
 
bool HasBreakableByDamageAuraType (AuraType type, uint32 excludeAura=0) const
 
bool HasBreakableByDamageCrowdControlAura (Unit *excludeCasterChannel=nullptr) const
 
AuraEffectIsScriptOverriden (SpellInfo const *spell, int32 script) const
 
uint32 GetDiseasesByCaster (ObjectGuid casterGUID, uint8 mode=0)
 
uint32 GetDoTsByCaster (ObjectGuid casterGUID) const
 
int32 GetTotalAuraModifier (AuraType auratype) const
 
float GetTotalAuraMultiplier (AuraType auratype) const
 
int32 GetMaxPositiveAuraModifier (AuraType auratype) const
 
int32 GetMaxNegativeAuraModifier (AuraType auratype) const
 
int32 GetTotalAuraModifier (AuraType auratype, std::function< bool(AuraEffect const *)> const &predicate) const
 
float GetTotalAuraMultiplier (AuraType auraType, std::function< bool(AuraEffect const *)> const &predicate) const
 
int32 GetMaxPositiveAuraModifier (AuraType auraType, std::function< bool(AuraEffect const *)> const &predicate) const
 
int32 GetMaxNegativeAuraModifier (AuraType auraType, std::function< bool(AuraEffect const *)> const &predicate) const
 
int32 GetTotalAuraModifierByMiscMask (AuraType auratype, uint32 misc_mask) const
 
float GetTotalAuraMultiplierByMiscMask (AuraType auratype, uint32 misc_mask) const
 
int32 GetMaxPositiveAuraModifierByMiscMask (AuraType auratype, uint32 misc_mask, const AuraEffect *except=nullptr) const
 
int32 GetMaxNegativeAuraModifierByMiscMask (AuraType auratype, uint32 misc_mask) const
 
int32 GetTotalAuraModifierByMiscValue (AuraType auratype, int32 misc_value) const
 
float GetTotalAuraMultiplierByMiscValue (AuraType auratype, int32 misc_value) const
 
int32 GetMaxPositiveAuraModifierByMiscValue (AuraType auratype, int32 misc_value) const
 
int32 GetMaxNegativeAuraModifierByMiscValue (AuraType auratype, int32 misc_value) const
 
int32 GetTotalAuraModifierByAffectMask (AuraType auratype, SpellInfo const *affectedSpell) const
 
float GetTotalAuraMultiplierByAffectMask (AuraType auratype, SpellInfo const *affectedSpell) const
 
int32 GetMaxPositiveAuraModifierByAffectMask (AuraType auratype, SpellInfo const *affectedSpell) const
 
int32 GetMaxNegativeAuraModifierByAffectMask (AuraType auratype, SpellInfo const *affectedSpell) const
 
VisibleAuraMap const * GetVisibleAuras ()
 
AuraApplicationGetVisibleAura (uint8 slot)
 
void SetVisibleAura (uint8 slot, AuraApplication *aur)
 
void RemoveVisibleAura (uint8 slot)
 
void ModifyAuraState (AuraStateType flag, bool apply)
 
uint32 BuildAuraStateUpdateForTarget (Unit *target) const
 
bool HasAuraState (AuraStateType flag, SpellInfo const *spellProto=nullptr, Unit const *Caster=nullptr) const
 
bool CanProc ()
 
void SetCantProc (bool apply)
 
void ProcSkillsAndReactives (bool isVictim, Unit *target, uint32 procFlag, uint32 procExtra, WeaponAttackType attType, SpellInfo const *procSpellInfo, uint32 damage, SpellInfo const *procAura=nullptr, int8 procAuraEffectIndex=-1, Spell const *procSpell=nullptr, DamageInfo *damageInfo=nullptr, HealInfo *healInfo=nullptr, uint32 procPhase=2)
 
void GetProcAurasTriggeredOnEvent (AuraApplicationProcContainer &aurasTriggeringProc, std::list< AuraApplication * > *procAuras, ProcEventInfo eventInfo)
 
void TriggerAurasProcOnEvent (CalcDamageInfo &damageInfo)
 
void TriggerAurasProcOnEvent (std::list< AuraApplication * > *myProcAuras, std::list< AuraApplication * > *targetProcAuras, Unit *actionTarget, uint32 typeMaskActor, uint32 typeMaskActionTarget, uint32 spellTypeMask, uint32 spellPhaseMask, uint32 hitMask, Spell *spell, DamageInfo *damageInfo, HealInfo *healInfo)
 
void TriggerAurasProcOnEvent (ProcEventInfo &eventInfo, AuraApplicationProcContainer &procAuras)
 
float GetWeaponProcChance () const
 
float GetPPMProcChance (uint32 WeaponSpeed, float PPM, SpellInfo const *spellProto) const
 
PlayerGetSpellModOwner () const
 
SpellGetCurrentSpell (CurrentSpellTypes spellType) const
 
SpellGetCurrentSpell (uint32 spellType) const
 
SpellGetFirstCurrentCastingSpell () const
 
SpellFindCurrentSpellBySpellId (uint32 spell_id) const
 
int32 GetCurrentSpellCastTime (uint32 spell_id) const
 
virtual bool HasSpell (uint32) const
 
void SetCurrentCastedSpell (Spell *pSpell)
 
virtual void ProhibitSpellSchool (SpellSchoolMask, uint32)
 
void SetInstantCast (bool set)
 
bool CanInstantCast () const
 
bool IsNonMeleeSpellCast (bool withDelayed, bool skipChanneled=false, bool skipAutorepeat=false, bool isAutoshoot=false, bool skipInstant=true) const
 
void InterruptNonMeleeSpells (bool withDelayed, uint32 spellid=0, bool withInstant=true, bool bySelf=false)
 
float GetSpellMaxRangeForTarget (Unit const *target, SpellInfo const *spellInfo) const
 
float GetSpellMinRangeForTarget (Unit const *target, SpellInfo const *spellInfo) const
 
uint32 GetInterruptMask () const
 
void AddInterruptMask (uint32 mask)
 
void UpdateInterruptMask ()
 
void InterruptSpell (CurrentSpellTypes spellType, bool withDelayed=true, bool withInstant=true, bool bySelf=false)
 
bool isSpellBlocked (Unit *victim, SpellInfo const *spellProto, WeaponAttackType attackType=BASE_ATTACK)
 
void FinishSpell (CurrentSpellTypes spellType, bool ok=true)
 
UnitGetMagicHitRedirectTarget (Unit *victim, SpellInfo const *spellInfo)
 
UnitGetMeleeHitRedirectTarget (Unit *victim, SpellInfo const *spellInfo=nullptr)
 
float MeleeSpellMissChance (Unit const *victim, WeaponAttackType attType, int32 skillDiff, uint32 spellId) const
 
SpellMissInfo MeleeSpellHitResult (Unit *victim, SpellInfo const *spell)
 
SpellMissInfo MagicSpellHitResult (Unit *victim, SpellInfo const *spell)
 
SpellMissInfo SpellHitResult (Unit *victim, SpellInfo const *spell, bool canReflect=false)
 
SpellMissInfo SpellHitResult (Unit *victim, Spell const *spell, bool canReflect=false)
 
void SendHealSpellLog (HealInfo const &healInfo, bool critical=false)
 
int32 HealBySpell (HealInfo &healInfo, bool critical=false)
 
int32 SpellBaseHealingBonusDone (SpellSchoolMask schoolMask)
 
float SpellPctHealingModsDone (Unit *victim, SpellInfo const *spellProto, DamageEffectType damagetype)
 
uint32 SpellHealingBonusDone (Unit *victim, SpellInfo const *spellProto, uint32 healamount, DamageEffectType damagetype, uint8 effIndex, float TotalMod=0.0f, uint32 stack=1)
 
uint32 SpellHealingBonusTaken (Unit *caster, SpellInfo const *spellProto, uint32 healamount, DamageEffectType damagetype, uint32 stack=1)
 
void SendEnergizeSpellLog (Unit *victim, uint32 SpellID, uint32 Damage, Powers powertype)
 
void EnergizeBySpell (Unit *victim, uint32 SpellID, uint32 Damage, Powers powertype)
 
void ApplySpellImmune (uint32 spellId, uint32 op, uint32 type, bool apply, SpellImmuneBlockType blockType=SPELL_BLOCK_TYPE_ALL)
 
void ApplySpellDispelImmunity (SpellInfo const *spellProto, DispelType type, bool apply)
 
virtual bool IsImmunedToSpell (SpellInfo const *spellInfo, Spell const *spell=nullptr)
 
bool IsImmunedToDamage (SpellSchoolMask meleeSchoolMask) const
 
bool IsImmunedToDamage (SpellInfo const *spellInfo) const
 
bool IsImmunedToDamage (Spell const *spell) const
 
bool IsImmunedToSchool (SpellSchoolMask meleeSchoolMask) const
 
bool IsImmunedToSchool (SpellInfo const *spellInfo) const
 
bool IsImmunedToSchool (Spell const *spell) const
 
bool IsImmunedToDamageOrSchool (SpellSchoolMask meleeSchoolMask) const
 
bool IsImmunedToDamageOrSchool (SpellInfo const *spellInfo) const
 
virtual bool IsImmunedToSpellEffect (SpellInfo const *spellInfo, uint32 index) const
 
bool isBlockCritical ()
 
float SpellDoneCritChance (Unit const *, SpellInfo const *spellProto, SpellSchoolMask schoolMask, WeaponAttackType attackType, bool skipEffectCheck) const
 
float SpellTakenCritChance (Unit const *caster, SpellInfo const *spellProto, SpellSchoolMask schoolMask, float doneChance, WeaponAttackType attackType, bool skipEffectCheck) const
 
float ApplyEffectModifiers (SpellInfo const *spellProto, uint8 effect_index, float value) const
 
int32 CalcSpellDuration (SpellInfo const *spellProto)
 
int32 ModSpellDuration (SpellInfo const *spellProto, Unit const *target, int32 duration, bool positive, uint32 effectMask)
 
void ModSpellCastTime (SpellInfo const *spellProto, int32 &castTime, Spell *spell=nullptr)
 
float CalculateLevelPenalty (SpellInfo const *spellProto) const
 
uint32 GetCastingTimeForBonus (SpellInfo const *spellProto, DamageEffectType damagetype, uint32 CastingTime) const
 
void CastDelayedSpellWithPeriodicAmount (Unit *caster, uint32 spellId, AuraType auraType, int32 addAmount, uint8 effectIndex=0)
 
SpellCastResult CastSpell (SpellCastTargets const &targets, SpellInfo const *spellInfo, CustomSpellValues const *value, TriggerCastFlags triggerFlags=TRIGGERED_NONE, Item *castItem=nullptr, AuraEffect const *triggeredByAura=nullptr, ObjectGuid originalCaster=ObjectGuid::Empty)
 
SpellCastResult CastSpell (Unit *victim, uint32 spellId, bool triggered, Item *castItem=nullptr, AuraEffect const *triggeredByAura=nullptr, ObjectGuid originalCaster=ObjectGuid::Empty)
 
SpellCastResult CastSpell (Unit *victim, uint32 spellId, TriggerCastFlags triggerFlags=TRIGGERED_NONE, Item *castItem=nullptr, AuraEffect const *triggeredByAura=nullptr, ObjectGuid originalCaster=ObjectGuid::Empty)
 
SpellCastResult CastSpell (Unit *victim, SpellInfo const *spellInfo, bool triggered, Item *castItem=nullptr, AuraEffect const *triggeredByAura=nullptr, ObjectGuid originalCaster=ObjectGuid::Empty)
 
SpellCastResult CastSpell (Unit *victim, SpellInfo const *spellInfo, TriggerCastFlags triggerFlags=TRIGGERED_NONE, Item *castItem=nullptr, AuraEffect const *triggeredByAura=nullptr, ObjectGuid originalCaster=ObjectGuid::Empty)
 
SpellCastResult CastSpell (float x, float y, float z, uint32 spellId, bool triggered, Item *castItem=nullptr, AuraEffect const *triggeredByAura=nullptr, ObjectGuid originalCaster=ObjectGuid::Empty)
 
SpellCastResult CastSpell (GameObject *go, uint32 spellId, bool triggered, Item *castItem=nullptr, AuraEffect *triggeredByAura=nullptr, ObjectGuid originalCaster=ObjectGuid::Empty)
 
SpellCastResult CastCustomSpell (Unit *victim, uint32 spellId, int32 const *bp0, int32 const *bp1, int32 const *bp2, bool triggered, Item *castItem=nullptr, AuraEffect const *triggeredByAura=nullptr, ObjectGuid originalCaster=ObjectGuid::Empty)
 
SpellCastResult CastCustomSpell (uint32 spellId, SpellValueMod mod, int32 value, Unit *victim, bool triggered, Item *castItem=nullptr, AuraEffect const *triggeredByAura=nullptr, ObjectGuid originalCaster=ObjectGuid::Empty)
 
SpellCastResult CastCustomSpell (uint32 spellId, SpellValueMod mod, int32 value, Unit *victim=nullptr, TriggerCastFlags triggerFlags=TRIGGERED_NONE, Item *castItem=nullptr, AuraEffect const *triggeredByAura=nullptr, ObjectGuid originalCaster=ObjectGuid::Empty)
 
SpellCastResult CastCustomSpell (uint32 spellId, CustomSpellValues const &value, Unit *victim=nullptr, TriggerCastFlags triggerFlags=TRIGGERED_NONE, Item *castItem=nullptr, AuraEffect const *triggeredByAura=nullptr, ObjectGuid originalCaster=ObjectGuid::Empty)
 
SpellCastResult CastCustomSpell (SpellInfo const *spellInfo, CustomSpellValues const &value, Unit *victim=nullptr, TriggerCastFlags triggerFlags=TRIGGERED_NONE, Item *castItem=nullptr, AuraEffect const *triggeredByAura=nullptr, ObjectGuid originalCaster=ObjectGuid::Empty)
 
void _RegisterDynObject (DynamicObject *dynObj)
 
void _UnregisterDynObject (DynamicObject *dynObj)
 
DynamicObjectGetDynObject (uint32 spellId)
 
bool RemoveDynObject (uint32 spellId)
 
void RemoveAllDynObjects ()
 
GameObjectGetGameObject (uint32 spellId) const
 
void AddGameObject (GameObject *gameObj)
 
void RemoveGameObject (GameObject *gameObj, bool del)
 
void RemoveGameObject (uint32 spellid, bool del)
 
void RemoveAllGameObjects ()
 
bool IsPolymorphed () const
 
bool isFrozen () const
 
bool IsInFlight () const
 
bool IsLevitating () const
 
bool IsWalking () const
 
bool isMoving () const
 
bool isTurning () const
 
bool IsHovering () const
 
bool isSwimming () const
 
virtual bool CanFly () const =0
 
bool IsFlying () const
 
bool IsFalling () const
 
bool IsRooted () const
 
float GetHoverHeight () const
 
virtual bool IsMovementPreventedByCasting () const
 
virtual bool CanEnterWater () const =0
 
virtual bool CanSwim () const
 this method checks the current flag of a unit
 
bool CanFreeMove () const
 
bool HasLeewayMovement () const
 
void KnockbackFrom (float x, float y, float speedXY, float speedZ)
 
void JumpTo (float speedXY, float speedZ, bool forward=true)
 
void JumpTo (WorldObject *obj, float speedZ)
 
void UpdateSpeed (UnitMoveType mtype, bool forced)
 
float GetSpeed (UnitMoveType mtype) const
 
float GetSpeedRate (UnitMoveType mtype) const
 
void SetSpeed (UnitMoveType mtype, float rate, bool forced=false)
 
void SetSpeedRate (UnitMoveType mtype, float rate)
 
void propagateSpeedChange ()
 
void SendMonsterMove (float NewPosX, float NewPosY, float NewPosZ, uint32 TransitTime, SplineFlags sf=SPLINEFLAG_WALK_MODE)
 
void MonsterMoveWithSpeed (float x, float y, float z, float speed)
 
virtual bool SetWalk (bool enable)
 
void SetDisableGravity (bool disable)
 
virtual bool SetSwim (bool enable)
 
void SetCanFly (bool enable)
 Add the movement flag: MOVEMENTFLAGCAN_FLY. Generaly only use by players, allowing them to fly by pressing space for example. For creatures, please look for DisableGravity().
 
void SetWaterWalking (bool enable)
 
void SetFeatherFall (bool enable)
 
void SetHover (bool enable)
 
MotionMasterGetMotionMaster ()
 
const MotionMasterGetMotionMaster () const
 
virtual MovementGeneratorType GetDefaultMovementType () const
 -------—End of Pet responses methods-------—
 
bool IsStopped () const
 
void StopMoving ()
 
void StopMovingOnCurrentPos ()
 
virtual void PauseMovement (uint32 timer=0, uint8 slot=0)
 Disable the unit movement by clearing UNIT_STATE_MOVING and stopping the spline.
 
void ResumeMovement (uint32 timer=0, uint8 slot=0)
 
void SetControlled (bool apply, UnitState state, Unit *source=nullptr, bool isFear=false)
 
void DisableRotate (bool apply)
 
void DisableSpline ()
 
SheathState GetSheath () const
 
virtual void SetSheath (SheathState sheathed)
 
uint8 getStandState () const
 
bool IsSitState () const
 
bool IsStandState () const
 
bool IsStandUpOnMovementState () const
 
void SetStandState (uint8 state)
 
void SetStandFlags (uint8 flags)
 
void RemoveStandFlags (uint8 flags)
 
DeathState getDeathState ()
 
virtual void setDeathState (DeathState s, bool despawn=false)
 
bool IsAlive () const
 
bool isDying () const
 
bool isDead () const
 
bool HasGhostAura () const
 
bool HasMountedAura () const
 
bool HasWaterWalkAura () const
 
bool HasFeatherFallAura () const
 
bool HasHoverAura () const
 
bool HasFlyAura () const
 
bool HasSpiritOfRedemptionAura () const
 
bool HasPreventsFleeingAura () const
 
bool HasPreventDurabilityLossAura () const
 
bool HasPreventResurectionAura () const
 
bool HasTransformAura () const
 
bool HasInterruptRegenAura () const
 
bool HasNoPVPCreditAura () const
 
bool HasWaterBreathingAura () const
 
bool HasIgnoreHitDirectionAura () const
 
bool HasSpellMagnetAura () const
 
bool HasOpenStableAura () const
 
bool HasCloneCasterAura () const
 
bool HasReflectSpellsAura () const
 
bool HasDetectAmoreAura () const
 
bool HasAllowOnlyAbilityAura () const
 
bool HasPeriodicDummyAura () const
 
bool HasControlVehicleAura () const
 
bool HasAOECharmAura () const
 
bool HasDetectSpellsAura () const
 
bool HasPacifySilenceAura () const
 
bool HasSilenceAura () const
 
bool HasShapeshiftAura () const
 
bool HasDecreaseSpeedAura () const
 
bool HasPacifyAura () const
 
bool HasIgnoreTargetResistAura () const
 
bool HasIncreaseMountedSpeedAura () const
 
bool HasIncreaseMountedFlightSpeedAura () const
 
bool HasThreatAura () const
 
bool HasAttackerSpellCritChanceAura () const
 
bool HasUnattackableAura () const
 
bool HasHealthRegenInCombatAura () const
 
bool HasRegenDuringCombatAura () const
 
bool HasFearAura () const
 
bool HasConfuseAura () const
 
bool HasRootAura () const
 
bool HasStunAura () const
 
bool HasTauntAura () const
 
bool HasStealthAura () const
 
bool HasStealthDetectAura () const
 
bool HasInvisibilityAura () const
 
bool HasInvisibilityDetectAura () const
 
bool IsHostileTo (Unit const *unit) const
 
bool IsHostileToPlayers () const
 
bool IsFriendlyTo (Unit const *unit) const
 
bool IsNeutralToAll () const
 
void ClearAllReactives ()
 
void StartReactiveTimer (ReactiveType reactive)
 
void UpdateReactives (uint32 p_time)
 
DiminishingLevels GetDiminishing (DiminishingGroup group)
 
void IncrDiminishing (DiminishingGroup group)
 
float ApplyDiminishingToDuration (DiminishingGroup group, int32 &duration, Unit *caster, DiminishingLevels Level, int32 limitduration)
 
void ApplyDiminishingAura (DiminishingGroup group, bool apply)
 
void ClearDiminishings ()
 
bool IsInPartyWith (Unit const *unit) const
 
bool IsInRaidWith (Unit const *unit) const
 
void GetPartyMembers (std::list< Unit * > &units)
 
UnitGetNextRandomRaidMemberOrPet (float radius)
 
void UpdateAuraForGroup (uint8 slot)
 
ReputationRank GetReactionTo (Unit const *target, bool checkOriginalFaction=false) const
 
ReputationRank GetFactionReactionTo (FactionTemplateEntry const *factionTemplateEntry, Unit const *target) const
 
SharedVisionList const & GetSharedVisionList ()
 
void AddPlayerToVision (Player *player)
 
void RemovePlayerFromVision (Player *player)
 
bool HasSharedVision () const
 
uint32 GetVirtualItemId (uint32 slot) const
 
void SetVirtualItem (uint32 slot, uint32 itemId)
 
bool IsMounted () const
 
uint32 GetMountID () const
 
void Mount (uint32 mount, uint32 vehicleId=0, uint32 creatureEntry=0)
 
void Dismount ()
 
bool IsInDisallowedMountForm () const
 
void addFollower (FollowerReference *pRef)
 
void removeFollower (FollowerReference *)
 
virtual float GetFollowAngle () const
 
GuardianGetGuardianPet () const
 
MinionGetFirstMinion () const
 
CreatureGetCompanionPet () const
 
PetCreateTamedPetFrom (Creature *creatureTarget, uint32 spell_id=0)
 
PetCreateTamedPetFrom (uint32 creatureEntry, uint32 spell_id=0)
 
bool InitTamedPet (Pet *pet, uint8 level, uint32 spell_id)
 
void SetMinion (Minion *minion, bool apply)
 
void GetAllMinionsByEntry (std::list< Creature * > &Minions, uint32 entry)
 
void RemoveAllMinionsByEntry (uint32 entry)
 
void AddPetAura (PetAura const *petSpell)
 
void RemovePetAura (PetAura const *petSpell)
 
void CastPetAura (PetAura const *aura)
 
bool IsPetAura (Aura const *aura)
 
void PetSpellFail (SpellInfo const *spellInfo, Unit *target, uint32 result)
 
void UnsummonAllTotems (bool onDeath=false)
 
TransportBaseGetDirectTransport () const
 
bool CreateVehicleKit (uint32 id, uint32 creatureEntry)
 Returns the transport this unit is on directly (if on vehicle and transport, return vehicle)
 
void RemoveVehicleKit ()
 
VehicleGetVehicleKit () const
 
VehicleGetVehicle () const
 
bool IsOnVehicle (Unit const *vehicle) const
 
UnitGetVehicleBase () const
 
CreatureGetVehicleCreatureBase () const
 
void EnterVehicle (Unit *base, int8 seatId=-1)
 
void EnterVehicleUnattackable (Unit *base, int8 seatId=-1)
 
void ExitVehicle (Position const *exitPosition=nullptr)
 
void ChangeSeat (int8 seatId, bool next=true)
 
bool HandleSpellClick (Unit *clicker, int8 seatId=-1)
 
void _ExitVehicle (Position const *exitPosition=nullptr)
 
void _EnterVehicle (Vehicle *vehicle, int8 seatId, AuraApplication const *aurApp=nullptr)
 
void HandleEmoteCommand (uint32 emoteId)
 
virtual void Talk (std::string_view text, ChatMsg msgType, Language language, float textRange, WorldObject const *target)
 
virtual void Say (std::string_view text, Language language, WorldObject const *target=nullptr)
 
virtual void Yell (std::string_view text, Language language, WorldObject const *target=nullptr)
 
virtual void TextEmote (std::string_view text, WorldObject const *target=nullptr, bool isBossEmote=false)
 
virtual void Whisper (std::string_view text, Language language, Player *target, bool isBossWhisper=false)
 
virtual void Talk (uint32 textId, ChatMsg msgType, float textRange, WorldObject const *target)
 
virtual void Say (uint32 textId, WorldObject const *target=nullptr)
 
virtual void Yell (uint32 textId, WorldObject const *target=nullptr)
 
virtual void TextEmote (uint32 textId, WorldObject const *target=nullptr, bool isBossEmote=false)
 
virtual void Whisper (uint32 textId, Player *target, bool isBossWhisper=false)
 
ShapeshiftForm GetShapeshiftForm () const
 
void SetShapeshiftForm (ShapeshiftForm form)
 
bool IsAttackSpeedOverridenShapeShift () const
 
bool IsInFeralForm () const
 
void setTransForm (uint32 spellid)
 
uint32 getTransForm () const
 
void DeMorph ()
 
virtual float GetNativeObjectScale () const
 
virtual void RecalculateObjectScale ()
 
uint32 GetDisplayId () const
 
virtual void SetDisplayId (uint32 modelId, float displayScale=1.f)
 
uint32 GetNativeDisplayId () const
 
void RestoreDisplayId ()
 
void SetNativeDisplayId (uint32 displayId)
 
uint32 GetModelForForm (ShapeshiftForm form, uint32 spellId)
 
virtual bool IsInWater () const
 
virtual bool IsUnderWater () const
 
void NearTeleportTo (Position &pos, bool casting=false, bool vehicleTeleport=false, bool withPet=false, bool removeTransport=false)
 
void NearTeleportTo (float x, float y, float z, float orientation, bool casting=false, bool vehicleTeleport=false, bool withPet=false, bool removeTransport=false)
 
void SetInFront (WorldObject const *target)
 
void SetFacingTo (float ori)
 
void SetFacingToObject (WorldObject *object, Milliseconds timed=0ms)
 
bool isInAccessiblePlaceFor (Creature const *c) const
 
bool isInFrontInMap (Unit const *target, float distance, float arc=M_PI) const
 
bool isInBackInMap (Unit const *target, float distance, float arc=M_PI) const
 
float GetCollisionHeight () const override
 Return collision height sent to client.
 
float GetCollisionWidth () const override
 this method gets the diameter of a Unit by DB if any value is defined, otherwise it gets the value by the DBC
 
float GetCollisionRadius () const override
 this method gets the radius of a Unit by DB if any value is defined, otherwise it gets the value by the DBC
 
void UpdateOrientation (float orientation)
 Only server-side orientation update, does not broadcast to client.
 
void UpdateHeight (float newZ)
 Only server-side height update, does not broadcast to client.
 
virtual bool UpdatePosition (float x, float y, float z, float ang, bool teleport=false)
 
bool UpdatePosition (const Position &pos, bool teleport=false)
 
void ProcessPositionDataChanged (PositionFullTerrainStatus const &data) override
 
virtual void ProcessTerrainStatusUpdate ()
 
bool IsVisible () const
 
void SetVisible (bool x)
 
void SetModelVisible (bool on)
 
uint32 GetPhaseByAuras () const
 
void SetPhaseMask (uint32 newPhaseMask, bool update) override
 
void UpdateObjectVisibility (bool forced=true, bool fromUpdate=false) override
 
void AddPointedBy (SafeUnitPointer *sup)
 
void RemovePointedBy (SafeUnitPointer *sup)
 
void SendAttackStateUpdate (CalcDamageInfo *damageInfo)
 
void SendAttackStateUpdate (uint32 HitInfo, Unit *target, uint8 SwingType, SpellSchoolMask damageSchoolMask, uint32 Damage, uint32 AbsorbDamage, uint32 Resist, VictimState TargetState, uint32 BlockedAmount)
 
void SendComboPoints ()
 
void SendPlaySpellVisual (uint32 id)
 
void SendPlaySpellImpact (ObjectGuid guid, uint32 id)
 
void SendPetActionFeedback (uint8 msg) const
 -------—Pet responses methods--------------—
 
void SendPetActionSound (PetAction action) const
 
void SendPetDismissSound () const
 
void SendPetAIReaction (ObjectGuid guid) const
 
void SendPeriodicAuraLog (SpellPeriodicAuraLogInfo *pInfo)
 
void SendSpellNonMeleeDamageLog (SpellNonMeleeDamage *log)
 
void SendSpellNonMeleeReflectLog (SpellNonMeleeDamage *log, Unit *attacker)
 
void SendSpellNonMeleeDamageLog (Unit *target, SpellInfo const *spellInfo, uint32 Damage, SpellSchoolMask damageSchoolMask, uint32 AbsorbedDamage, uint32 Resist, bool PhysicalDamage, uint32 Blocked, bool CriticalHit=false, bool Split=false)
 
void SendSpellMiss (Unit *target, uint32 spellID, SpellMissInfo missInfo)
 
void SendSpellDamageResist (Unit *target, uint32 spellId)
 
void SendSpellDamageImmune (Unit *target, uint32 spellId)
 
void SendTameFailure (uint8 result)
 
void SendTeleportPacket (Position &pos)
 
void SendMovementFlagUpdate (bool self=false)
 
void SendMovementWaterWalking (Player *sendTo)
 
void SendMovementFeatherFall (Player *sendTo)
 
void SendMovementHover (Player *sendTo)
 
void SendChangeCurrentVictimOpcode (HostileReference *pHostileReference)
 
void SendClearThreatListOpcode ()
 
void SendRemoveFromThreatListOpcode (HostileReference *pHostileReference)
 
void SendThreatListUpdate ()
 
void SendClearTarget ()
 
void ExecuteDelayedUnitRelocationEvent ()
 
void ExecuteDelayedUnitAINotifyEvent ()
 
void BuildHeartBeatMsg (WorldPacket *data) const
 
void BuildMovementPacket (ByteBuffer *data) const
 
void OutDebugInfo () const
 
std::string GetDebugInfo () const override
 
- Public Member Functions inherited from WorldObject
 ~WorldObject () override
 
void _Create (ObjectGuid::LowType guidlow, HighGuid guidhigh, uint32 phaseMask)
 
void AddToWorld () override
 
void RemoveFromWorld () override
 
void GetNearPoint2D (WorldObject const *searcher, float &x, float &y, float distance, float absAngle, Position const *startPos=nullptr) const
 
void GetNearPoint2D (float &x, float &y, float distance, float absAngle, Position const *startPos=nullptr) const
 
void GetNearPoint (WorldObject const *searcher, float &x, float &y, float &z, float searcher_size, float distance2d, float absAngle, float controlZ=0, Position const *startPos=nullptr) const
 
void GetVoidClosePoint (float &x, float &y, float &z, float size, float distance2d=0, float relAngle=0, float controlZ=0) const
 
bool GetClosePoint (float &x, float &y, float &z, float size, float distance2d=0, float angle=0, WorldObject const *forWho=nullptr, bool force=false) const
 
void MovePosition (Position &pos, float dist, float angle)
 
Position GetNearPosition (float dist, float angle)
 
void MovePositionToFirstCollision (Position &pos, float dist, float angle)
 
Position GetFirstCollisionPosition (float startX, float startY, float startZ, float destX, float destY)
 
Position GetFirstCollisionPosition (float destX, float destY, float destZ)
 
Position GetFirstCollisionPosition (float dist, float angle)
 
Position GetRandomNearPosition (float radius)
 
void GetContactPoint (WorldObject const *obj, float &x, float &y, float &z, float distance2d=CONTACT_DISTANCE) const
 
void GetChargeContactPoint (WorldObject const *obj, float &x, float &y, float &z, float distance2d=CONTACT_DISTANCE) const
 
float GetObjectSize () const
 
void UpdateGroundPositionZ (float x, float y, float &z) const
 
void UpdateAllowedPositionZ (float x, float y, float &z, float *groundZ=nullptr) const
 
void GetRandomPoint (const Position &srcPos, float distance, float &rand_x, float &rand_y, float &rand_z) const
 
Position GetRandomPoint (const Position &srcPos, float distance) const
 
uint32 GetInstanceId () const
 
uint32 GetPhaseMask () const
 
bool InSamePhase (WorldObject const *obj) const
 
bool InSamePhase (uint32 phasemask) const
 
uint32 GetZoneId () const
 
uint32 GetAreaId () const
 
void GetZoneAndAreaId (uint32 &zoneid, uint32 &areaid) const
 
bool IsOutdoors () const
 
LiquidData const & GetLiquidData () const
 
InstanceScriptGetInstanceScript () const
 
std::string const & GetName () const
 
void SetName (std::string const &newname)
 
virtual std::string const & GetNameForLocaleIdx (LocaleConstant) const
 
float GetDistance (WorldObject const *obj) const
 
float GetDistance (const Position &pos) const
 
float GetDistance (float x, float y, float z) const
 
float GetDistance2d (WorldObject const *obj) const
 
float GetDistance2d (float x, float y) const
 
float GetDistanceZ (WorldObject const *obj) const
 
bool IsSelfOrInSameMap (WorldObject const *obj) const
 
bool IsInMap (WorldObject const *obj) const
 
bool IsWithinDist3d (float x, float y, float z, float dist) const
 
bool IsWithinDist3d (const Position *pos, float dist) const
 
bool IsWithinDist2d (float x, float y, float dist) const
 
bool IsWithinDist2d (const Position *pos, float dist) const
 
bool IsWithinDist (WorldObject const *obj, float dist2compare, bool is3D=true, bool incOwnRadius=true, bool incTargetRadius=true) const
 
bool IsWithinDistInMap (WorldObject const *obj, float dist2compare, bool is3D=true, bool incOwnRadius=true, bool incTargetRadius=true) const
 
bool IsWithinLOS (float x, float y, float z, VMAP::ModelIgnoreFlags ignoreFlags=VMAP::ModelIgnoreFlags::Nothing, LineOfSightChecks checks=LINEOFSIGHT_ALL_CHECKS) const
 
bool IsWithinLOSInMap (WorldObject const *obj, VMAP::ModelIgnoreFlags ignoreFlags=VMAP::ModelIgnoreFlags::Nothing, LineOfSightChecks checks=LINEOFSIGHT_ALL_CHECKS, Optional< float > collisionHeight={ }, Optional< float > combatReach={ }) const
 
Position GetHitSpherePointFor (Position const &dest, Optional< float > collisionHeight={ }, Optional< float > combatReach={ }) const
 
void GetHitSpherePointFor (Position const &dest, float &x, float &y, float &z, Optional< float > collisionHeight={ }, Optional< float > combatReach={ }) const
 
bool GetDistanceOrder (WorldObject const *obj1, WorldObject const *obj2, bool is3D=true) const
 
bool IsInRange (WorldObject const *obj, float minRange, float maxRange, bool is3D=true) const
 
bool IsInRange2d (float x, float y, float minRange, float maxRange) const
 
bool IsInRange3d (float x, float y, float z, float minRange, float maxRange) const
 
bool isInFront (WorldObject const *target, float arc=M_PI) const
 
bool isInBack (WorldObject const *target, float arc=M_PI) const
 
bool IsInBetween (WorldObject const *obj1, WorldObject const *obj2, float size=0) const
 
virtual void SendMessageToSet (WorldPacket const *data, bool self) const
 
virtual void SendMessageToSetInRange (WorldPacket const *data, float dist, bool self) const
 
virtual void SendMessageToSet (WorldPacket const *data, Player const *skipped_rcvr) const
 
void PlayDistanceSound (uint32 sound_id, Player *target=nullptr)
 
void PlayDirectSound (uint32 sound_id, Player *target=nullptr)
 
void PlayRadiusSound (uint32 sound_id, float radius)
 
void PlayDirectMusic (uint32 music_id, Player *target=nullptr)
 
void PlayRadiusMusic (uint32 music_id, float radius)
 
template<typename Worker >
void DoForAllVisiblePlayers (Worker &&worker)
 
template<typename Worker >
void DoForAllVisibleWorldObjects (Worker &&worker)
 
void DestroyForVisiblePlayers ()
 
void SendObjectDeSpawnAnim (ObjectGuid guid)
 
virtual void SaveRespawnTime ()
 
void AddObjectToRemoveList ()
 
float GetGridActivationRange () const
 
float GetVisibilityRange () const
 
virtual float GetSightRange (WorldObject const *target=nullptr) const
 
bool CanSeeOrDetect (WorldObject const *obj, bool ignoreStealth=false, bool distanceCheck=false, bool checkAlert=false) const
 
void SendPlayMusic (uint32 Music, bool OnlySelf)
 
virtual void SetMap (Map *map)
 
virtual void ResetMap ()
 
MapGetMap () const
 
MapFindMap () const
 
void SetZoneScript ()
 
void ClearZoneScript ()
 
ZoneScriptGetZoneScript () const
 
TempSummonSummonCreature (uint32 id, const Position &pos, TempSummonType spwtype=TEMPSUMMON_MANUAL_DESPAWN, uint32 despwtime=0, uint32 vehId=0, SummonPropertiesEntry const *properties=nullptr, bool visibleBySummonerOnly=false) const
 
TempSummonSummonCreature (uint32 id, float x, float y, float z, float ang=0, TempSummonType spwtype=TEMPSUMMON_MANUAL_DESPAWN, uint32 despwtime=0, SummonPropertiesEntry const *properties=nullptr, bool visibleBySummonerOnly=false)
 
GameObjectSummonGameObject (uint32 entry, float x, float y, float z, float ang, float rotation0, float rotation1, float rotation2, float rotation3, uint32 respawnTime, bool checkTransport=true, GOSummonType summonType=GO_SUMMON_TIMED_OR_CORPSE_DESPAWN)
 
CreatureSummonTrigger (float x, float y, float z, float ang, uint32 dur, bool setLevel=false, CreatureAI *(*GetAI)(Creature *)=nullptr)
 
void SummonCreatureGroup (uint8 group, std::list< TempSummon * > *list=nullptr)
 
void SummonGameObjectGroup (uint8 group, std::list< GameObject * > *list=nullptr)
 
CreatureFindNearestCreature (uint32 entry, float range, bool alive=true) const
 
GameObjectFindNearestGameObject (uint32 entry, float range, bool onlySpawned=false) const
 
GameObjectFindNearestGameObjectOfType (GameobjectTypes type, float range) const
 
PlayerSelectNearestPlayer (float distance=0) const
 
void GetGameObjectListWithEntryInGrid (std::list< GameObject * > &lList, uint32 uiEntry, float fMaxSearchRange) const
 
void GetGameObjectListWithEntryInGrid (std::list< GameObject * > &gameobjectList, std::vector< uint32 > const &entries, float maxSearchRange) const
 
void GetCreatureListWithEntryInGrid (std::list< Creature * > &lList, uint32 uiEntry, float fMaxSearchRange) const
 
void GetCreatureListWithEntryInGrid (std::list< Creature * > &creatureList, std::vector< uint32 > const &entries, float maxSearchRange) const
 
void GetDeadCreatureListInGrid (std::list< Creature * > &lList, float maxSearchRange, bool alive=false) const
 
virtual void UpdateObjectVisibilityOnCreate ()
 
void BuildUpdate (UpdateDataMapType &data_map) override
 
void GetCreaturesWithEntryInRange (std::list< Creature * > &creatureList, float radius, uint32 entry)
 
void SetPositionDataUpdate ()
 
void UpdatePositionData ()
 
void AddToObjectUpdate () override
 
void RemoveFromObjectUpdate () override
 
void AddToNotify (uint16 f)
 
void RemoveFromNotify (uint16 f)
 
bool isNeedNotify (uint16 f) const
 
uint16 GetNotifyFlags () const
 
bool NotifyExecuted (uint16 f) const
 
void SetNotified (uint16 f)
 
void ResetAllNotifies ()
 
bool isActiveObject () const
 
void setActive (bool isActiveObject)
 
VisibilityDistanceType GetVisibilityOverrideType () const
 
bool IsVisibilityOverridden () const
 
bool IsZoneWideVisible () const
 
bool IsFarVisible () const
 
float GetVisibilityOverrideDistance () const
 
void SetVisibilityDistanceOverride (VisibilityDistanceType type)
 
bool IsInWintergrasp () const
 
TransportGetTransport () const
 
float GetTransOffsetX () const
 
float GetTransOffsetY () const
 
float GetTransOffsetZ () const
 
float GetTransOffsetO () const
 
uint32 GetTransTime () const
 
int8 GetTransSeat () const
 
void SetTransport (Transport *t)
 
virtual float GetStationaryX () const
 
virtual float GetStationaryY () const
 
virtual float GetStationaryZ () const
 
virtual float GetStationaryO () const
 
float GetMapWaterOrGroundLevel (Position pos, float *ground=nullptr) const
 
float GetMapWaterOrGroundLevel (float x, float y, float z, float *ground=nullptr) const
 
float GetMapHeight (float x, float y, float z, bool vmap=true, float distanceToSearch=50.0f) const
 
float GetFloorZ () const
 
float GetMinHeightInWater () const
 Get the minimum height of a object that should be in water to start floating/swim.
 
void AddAllowedLooter (ObjectGuid guid)
 
void ResetAllowedLooters ()
 
void SetAllowedLooters (GuidUnorderedSet const looters)
 
bool HasAllowedLooter (ObjectGuid guid) const
 
GuidUnorderedSet const & GetAllowedLooters () const
 
void RemoveAllowedLooter (ObjectGuid guid)
 
virtual bool IsUpdateNeeded ()
 
bool CanBeAddedToMapUpdateList ()
 
std::string GetDebugInfo () const override
 
ObjectVisibilityContainerGetObjectVisibilityContainer ()
 
ObjectVisibilityContainer const & GetObjectVisibilityContainer () const
 
- Public Member Functions inherited from Object
virtual ~Object ()
 
bool IsInWorld () const
 
ObjectGuid GetGUID () const
 
PackedGuid const & GetPackGUID () const
 
uint32 GetEntry () const
 
void SetEntry (uint32 entry)
 
float GetObjectScale () const
 
virtual void SetObjectScale (float scale)
 
bool HasDynamicFlag (uint32 flag) const
 
virtual void SetDynamicFlag (uint32 flag)
 
virtual void RemoveDynamicFlag (uint32 flag)
 
TypeID GetTypeId () const
 
bool isType (uint16 mask) const
 
virtual void BuildCreateUpdateBlockForPlayer (UpdateData *data, Player *target)
 
void SendUpdateToPlayer (Player *player)
 
void BuildValuesUpdateBlockForPlayer (UpdateData *data, Player *target)
 
void BuildOutOfRangeUpdateBlock (UpdateData *data) const
 
void BuildMovementUpdateBlock (UpdateData *data, uint32 flags=0) const
 
virtual void DestroyForPlayer (Player *target, bool onDeath=false) const
 
int32 GetInt32Value (uint16 index) const
 
uint32 GetUInt32Value (uint16 index) const
 
uint64 GetUInt64Value (uint16 index) const
 
float GetFloatValue (uint16 index) const
 
uint8 GetByteValue (uint16 index, uint8 offset) const
 
uint16 GetUInt16Value (uint16 index, uint8 offset) const
 
ObjectGuid GetGuidValue (uint16 index) const
 
void SetInt32Value (uint16 index, int32 value)
 
void SetUInt32Value (uint16 index, uint32 value)
 
void UpdateUInt32Value (uint16 index, uint32 value)
 
void SetUInt64Value (uint16 index, uint64 value)
 
void SetFloatValue (uint16 index, float value)
 
void SetByteValue (uint16 index, uint8 offset, uint8 value)
 
void SetUInt16Value (uint16 index, uint8 offset, uint16 value)
 
void SetInt16Value (uint16 index, uint8 offset, int16 value)
 
void SetGuidValue (uint16 index, ObjectGuid value)
 
void SetStatFloatValue (uint16 index, float value)
 
void SetStatInt32Value (uint16 index, int32 value)
 
bool AddGuidValue (uint16 index, ObjectGuid value)
 
bool RemoveGuidValue (uint16 index, ObjectGuid value)
 
void ApplyModUInt32Value (uint16 index, int32 val, bool apply)
 
void ApplyModInt32Value (uint16 index, int32 val, bool apply)
 
void ApplyModUInt64Value (uint16 index, int32 val, bool apply)
 
void ApplyModPositiveFloatValue (uint16 index, float val, bool apply)
 
void ApplyModSignedFloatValue (uint16 index, float val, bool apply)
 
void SetFlag (uint16 index, uint32 newFlag)
 
void RemoveFlag (uint16 index, uint32 oldFlag)
 
void ToggleFlag (uint16 index, uint32 flag)
 
bool HasFlag (uint16 index, uint32 flag) const
 
void ApplyModFlag (uint16 index, uint32 flag, bool apply)
 
void SetByteFlag (uint16 index, uint8 offset, uint8 newFlag)
 
void RemoveByteFlag (uint16 index, uint8 offset, uint8 newFlag)
 
bool HasByteFlag (uint16 index, uint8 offset, uint8 flag) const
 
void SetFlag64 (uint16 index, uint64 newFlag)
 
void RemoveFlag64 (uint16 index, uint64 oldFlag)
 
void ToggleFlag64 (uint16 index, uint64 flag)
 
bool HasFlag64 (uint16 index, uint64 flag) const
 
void ApplyModFlag64 (uint16 index, uint64 flag, bool apply)
 
void ClearUpdateMask (bool remove)
 
uint16 GetValuesCount () const
 
virtual bool hasQuest (uint32) const
 
virtual bool hasInvolvedQuest (uint32) const
 
void BuildFieldsUpdate (Player *, UpdateDataMapType &)
 
void SetFieldNotifyFlag (uint16 flag)
 
void RemoveFieldNotifyFlag (uint16 flag)
 
void ForceValuesUpdateAtIndex (uint32)
 
bool IsPlayer () const
 
PlayerToPlayer ()
 
Player const * ToPlayer () const
 
bool IsCreature () const
 
CreatureToCreature ()
 
Creature const * ToCreature () const
 
bool IsUnit () const
 
UnitToUnit ()
 
Unit const * ToUnit () const
 
bool IsGameObject () const
 
GameObjectToGameObject ()
 
GameObject const * ToGameObject () const
 
bool IsCorpse () const
 
CorpseToCorpse ()
 
Corpse const * ToCorpse () const
 
bool IsDynamicObject () const
 
DynamicObjectToDynObject ()
 
DynamicObject const * ToDynObject () const
 
bool IsItem () const
 
virtual void Heartbeat ()
 
template<typename... T>
bool EntryEquals (T... entries) const
 
- Public Member Functions inherited from WorldLocation
 WorldLocation (uint32 _mapId=MAPID_INVALID, float x=0.f, float y=0.f, float z=0.f, float o=0.f)
 
 WorldLocation (uint32 mapId, Position const &position)
 
void WorldRelocate (const WorldLocation &loc)
 
void WorldRelocate (uint32 mapId=MAPID_INVALID, float x=0.f, float y=0.f, float z=0.f, float o=0.f)
 
void SetMapId (uint32 mapId)
 
uint32 GetMapId () const
 
void GetWorldLocation (uint32 &mapId, float &x, float &y) const
 
void GetWorldLocation (uint32 &mapId, float &x, float &y, float &z) const
 
void GetWorldLocation (uint32 &mapId, float &x, float &y, float &z, float &o) const
 
void GetWorldLocation (WorldLocation *location) const
 
WorldLocation GetWorldLocation () const
 
std::string GetDebugInfo () const
 
- Public Member Functions inherited from Position
 Position (float x=0, float y=0, float z=0, float o=0)
 
 Position (Position const &loc)
 
 Position (Position &&)=default
 
Positionoperator= (const Position &)=default
 
Positionoperator= (Position &&)=default
 
bool operator== (Position const &a) const
 
bool operator!= (Position const &a)
 
bool operator!= (Position const &a) const
 
 operator G3D::Vector3 () const
 
void Relocate (float x, float y)
 
void Relocate (float x, float y, float z)
 
void Relocate (float x, float y, float z, float orientation)
 
void Relocate (const Position &pos)
 
void Relocate (const Position *pos)
 
void RelocatePolarOffset (float angle, float dist, float z=0.0f)
 
void RelocateOffset (const Position &offset)
 
void SetOrientation (float orientation)
 
float GetPositionX () const
 
float GetPositionY () const
 
float GetPositionZ () const
 
float GetOrientation () const
 
void GetPosition (float &x, float &y) const
 
void GetPosition (float &x, float &y, float &z) const
 
void GetPosition (float &x, float &y, float &z, float &o) const
 
Position GetPosition () const
 
Position::PositionXYZStreamer PositionXYZStream ()
 
Position::PositionXYZOStreamer PositionXYZOStream ()
 
bool IsPositionValid () const
 
float GetExactDist2dSq (const float x, const float y) const
 
float GetExactDist2dSq (Position const &pos) const
 
float GetExactDist2dSq (Position const *pos) const
 
float GetExactDist2d (const float x, const float y) const
 
float GetExactDist2d (Position const &pos) const
 
float GetExactDist2d (Position const *pos) const
 
float GetExactDistSq (float x, float y, float z) const
 
float GetExactDistSq (Position const &pos) const
 
float GetExactDistSq (Position const *pos) const
 
float GetExactDist (float x, float y, float z) const
 
float GetExactDist (Position const &pos) const
 
float GetExactDist (Position const *pos) const
 
void GetPositionOffsetTo (const Position &endPos, Position &retOffset) const
 
Position GetPositionWithOffset (Position const &offset) const
 
float GetAngle (const Position *pos) const
 
float GetAngle (float x, float y) const
 
float GetAbsoluteAngle (float x, float y) const
 
float GetAbsoluteAngle (Position const &pos) const
 
float GetAbsoluteAngle (Position const *pos) const
 
float GetRelativeAngle (const Position *pos) const
 
float GetRelativeAngle (float x, float y) const
 
float ToAbsoluteAngle (float relAngle) const
 
void GetSinCos (float x, float y, float &vsin, float &vcos) const
 
bool IsInDist2d (float x, float y, float dist) const
 
bool IsInDist2d (const Position *pos, float dist) const
 
bool IsInDist (float x, float y, float z, float dist) const
 
bool IsInDist (const Position *pos, float dist) const
 
bool IsWithinBox (const Position &center, float xradius, float yradius, float zradius) const
 
bool HasInArc (float arcangle, const Position *pos, float targetRadius=0.0f) const
 
bool HasInLine (Position const *pos, float width) const
 
bool HasInLine (Position const *pos, float objSize, float width) const
 
std::string ToString () const
 

Static Public Member Functions

static void ApplyResilience (Unit const *victim, float *crit, int32 *damage, bool isCrit, CombatRating type)
 
static float GetEffectiveResistChance (Unit const *owner, SpellSchoolMask schoolMask, Unit const *victim)
 
static uint32 DealDamage (Unit *attacker, Unit *victim, uint32 damage, CleanDamage const *cleanDamage=nullptr, DamageEffectType damagetype=DIRECT_DAMAGE, SpellSchoolMask damageSchoolMask=SPELL_SCHOOL_MASK_NORMAL, SpellInfo const *spellProto=nullptr, bool durabilityLoss=true, bool allowGM=false, Spell const *spell=nullptr)
 
static void DealDamageMods (Unit const *victim, uint32 &damage, uint32 *absorb)
 
static void Kill (Unit *killer, Unit *victim, bool durabilityLoss=true, WeaponAttackType attackType=BASE_ATTACK, SpellInfo const *spellProto=nullptr, Spell const *spell=nullptr)
 
static bool IsDamageReducedByArmor (SpellSchoolMask damageSchoolMask, SpellInfo const *spellInfo=nullptr, uint8 effIndex=MAX_SPELL_EFFECTS)
 
static uint32 CalcArmorReducedDamage (Unit const *attacker, Unit const *victim, const uint32 damage, SpellInfo const *spellInfo, uint8 attackerLevel=0, WeaponAttackType attackType=MAX_ATTACK)
 
static uint32 SpellCriticalDamageBonus (Unit const *caster, SpellInfo const *spellProto, uint32 damage, Unit const *victim)
 
static void ProcSkillsAndAuras (Unit *actor, Unit *victim, uint32 procAttacker, uint32 procVictim, uint32 procEx, uint32 amount, WeaponAttackType attType=BASE_ATTACK, SpellInfo const *procSpellInfo=nullptr, SpellInfo const *procAura=nullptr, int8 procAuraEffectIndex=-1, Spell const *procSpell=nullptr, DamageInfo *damageInfo=nullptr, HealInfo *healInfo=nullptr, uint32 procPhase=2)
 
static int32 DealHeal (Unit *healer, Unit *victim, uint32 addhealth)
 
static uint32 SpellCriticalHealingBonus (Unit const *caster, SpellInfo const *spellProto, uint32 damage, Unit const *victim)
 
static void CalcAbsorbResist (DamageInfo &dmgInfo, bool Splited=false)
 
static void CalcHealAbsorb (HealInfo &healInfo)
 
static void HandleSafeUnitPointersOnDelete (Unit *thisUnit)
 
- Static Public Member Functions inherited from Object
static ObjectGuid GetGUID (Object const *o)
 
- Static Public Member Functions inherited from Position
static float NormalizeOrientation (float o)
 

Public Attributes

uint32 m_extraAttacks
 
DualWieldMode _dualWieldMode
 
ControlSet m_Controlled
 
SafeUnitPointer m_movedByPlayer
 
ObjectGuid m_SummonSlot [MAX_SUMMON_SLOT]
 
ObjectGuid m_ObjectSlot [MAX_GAMEOBJECT_SLOT]
 
float m_modMeleeHitChance
 
float m_modRangedHitChance
 
float m_modSpellHitChance
 
int32 m_baseSpellCritChance
 
float m_threatModifier [MAX_SPELL_SCHOOL]
 
float m_modAttackSpeedPct [3]
 
SpellImmuneList m_spellImmune [MAX_SPELL_IMMUNITY]
 
uint32 m_lastSanctuaryTime
 
PetAuraSet m_petAuras
 
bool IsAIEnabled
 
bool NeedChangeAI
 
bool m_ControlledByPlayer
 
bool m_CreatedByPlayer
 
std::set< SafeUnitPointer * > SafeUnitPointerSet
 
Position m_last_notify_position
 
uint32 m_last_notify_mstime
 
uint16 m_delayed_unit_relocation_timer
 
uint16 m_delayed_unit_ai_notify_timer
 
bool bRequestForcedVisibilityUpdate
 
Movement::MoveSplinemovespline
 
- Public Attributes inherited from WorldObject
FlaggedValuesArray32< int32, uint32, StealthType, TOTAL_STEALTH_TYPESm_stealth
 
FlaggedValuesArray32< int32, uint32, StealthType, TOTAL_STEALTH_TYPESm_stealthDetect
 
FlaggedValuesArray32< int32, uint32, InvisibilityType, TOTAL_INVISIBILITY_TYPESm_invisibility
 
FlaggedValuesArray32< int32, uint32, InvisibilityType, TOTAL_INVISIBILITY_TYPESm_invisibilityDetect
 
FlaggedValuesArray32< int32, uint32, ServerSideVisibilityType, TOTAL_SERVERSIDE_VISIBILITY_TYPESm_serverSideVisibility
 
FlaggedValuesArray32< int32, uint32, ServerSideVisibilityType, TOTAL_SERVERSIDE_VISIBILITY_TYPESm_serverSideVisibilityDetect
 
uint32 LastUsedScriptID
 
MovementInfo m_movementInfo
 
ALEEventProcessor * ALEEvents
 
EventProcessor m_Events
 
- Public Attributes inherited from Object
DataMap CustomData
 
- Public Attributes inherited from WorldLocation
uint32 m_mapId
 
- Public Attributes inherited from Position
float m_positionX = 0
 
float m_positionY = 0
 
float m_positionZ = 0
 
float m_orientation = 0
 

Protected Types

typedef std::list< DynamicObject * > DynObjectList
 
typedef GuidList GameObjectList
 
typedef std::map< ObjectGuid, float > CharmThreatMap
 

Protected Member Functions

 Unit ()
 
void BuildValuesUpdate (uint8 updateType, ByteBuffer *data, Player *target) override
 
void _UpdateSpells (uint32 time)
 
void _DeleteRemovedAuras ()
 
void _UpdateAutoRepeatSpell ()
 
bool CanSparringWith (Unit const *attacker) const
 
bool IsAlwaysVisibleFor (WorldObject const *seer) const override
 : Check if unit is eligible for sparring damages. Work only if attacker and victim are creatures.
 
bool IsAlwaysDetectableFor (WorldObject const *seer) const override
 
void SetFeared (bool apply, Unit *fearedBy=nullptr, bool isFear=false)
 
void SetConfused (bool apply)
 
void SetStunned (bool apply)
 
void SetRooted (bool apply, bool stun=false, bool logout=false)
 
void SendMoveRoot (bool state)
 
- Protected Member Functions inherited from WorldObject
 WorldObject ()
 
void SetLocationMapId (uint32 _mapId)
 
void SetLocationInstanceId (uint32 _instanceId)
 
virtual bool IsNeverVisible () const
 
virtual bool IsInvisibleDueToDespawn () const
 
- Protected Member Functions inherited from Object
 Object ()
 
void _InitValues ()
 
void _Create (ObjectGuid::LowType guidlow, uint32 entry, HighGuid guidhigh)
 
std::string _ConcatFields (uint16 startIndex, uint16 size) const
 
bool _LoadIntoDataField (std::string const &data, uint32 startOffset, uint32 count)
 
uint32 GetUpdateFieldData (Player const *target, uint32 *&flags) const
 
void BuildMovementUpdate (ByteBuffer *data, uint16 flags) const
 
void AddToObjectUpdateIfNeeded ()
 

Protected Attributes

UnitAIi_AI
 
UnitAIi_disabledAI
 
uint8 m_realRace
 
uint8 m_race
 
bool m_AutoRepeatFirstCast
 
int32 m_attackTimer [MAX_ATTACK]
 
float m_createStats [MAX_STATS]
 
AttackerSet m_attackers
 
Unitm_attacking
 
DeathState m_deathState
 
int32 m_procDeep
 
DynObjectList m_dynObj
 
GameObjectList m_gameObj
 
uint32 m_transform
 
Spellm_currentSpells [CURRENT_MAX_SPELL]
 
AuraMap m_ownedAuras
 
AuraApplicationMap m_appliedAuras
 
AuraList m_removedAuras
 
AuraMap::iterator m_auraUpdateIterator
 
uint32 m_removedAurasCount
 
AuraEffectList m_modAuras [TOTAL_AURAS]
 
AuraList m_scAuras
 
AuraApplicationList m_interruptableAuras
 
AuraStateAurasMap m_auraStateAuras
 
uint32 m_interruptMask
 
float m_auraFlatModifiersGroup [UNIT_MOD_END][MODIFIER_TYPE_FLAT_END]
 
float m_auraPctModifiersGroup [UNIT_MOD_END][MODIFIER_TYPE_PCT_END]
 
float m_weaponDamage [MAX_ATTACK][MAX_WEAPON_DAMAGE_RANGE][MAX_ITEM_PROTO_DAMAGES]
 
bool m_canModifyStats
 
VisibleAuraMap m_visibleAuras
 
float m_speed_rate [MAX_MOVE_TYPE]
 
CharmInfom_charmInfo
 
SharedVisionList m_sharedVision
 
MotionMasteri_motionMaster
 
uint32 m_reactiveTimer [MAX_REACTIVE]
 
int32 m_regenTimer
 
ThreatMgr m_ThreatMgr
 
CharmThreatMap _charmThreatInfo
 
Vehiclem_vehicle
 
Vehiclem_vehicleKit
 
uint32 m_unitTypeMask
 
LiquidTypeEntry const * _lastLiquid
 
bool m_applyResilience
 
bool _instantCast
 
- Protected Attributes inherited from WorldObject
std::string m_name
 
bool m_isActive
 
VisibilityDistanceType _visibilityDistanceOverrideType
 
ZoneScriptm_zoneScript
 
uint32 _zoneId
 
uint32 _areaId
 
float _floorZ
 
bool _outdoors
 
LiquidData _liquidData
 
bool _updatePositionData
 
Transportm_transport
 
- Protected Attributes inherited from Object
uint16 m_objectType
 
TypeID m_objectTypeId
 
uint16 m_updateFlag
 
union { 
 
   int32 *   m_int32Values 
 
   uint32 *   m_uint32Values 
 
   float *   m_floatValues 
 
};  
 
UpdateMask _changesMask
 
uint16 m_valuesCount
 
uint16 _fieldNotifyFlags
 
bool m_objectUpdated
 

Private Types

typedef std::unordered_map< uint64, BuildValuesCachedBufferValuesUpdateCache
 

Private Member Functions

bool HandleAuraRaidProcFromChargeWithValue (AuraEffect *triggeredByAura)
 
bool HandleAuraRaidProcFromCharge (AuraEffect *triggeredByAura)
 
void UpdateSplineMovement (uint32 t_diff)
 
void UpdateSplinePosition ()
 
float GetCombatRatingReduction (CombatRating cr) const
 
uint32 GetCombatRatingDamageReduction (CombatRating cr, float rate, float cap, uint32 damage) const
 
void PatchValuesUpdate (ByteBuffer &valuesUpdateBuf, BuildValuesCachePosPointers &posPointers, Player *target)
 
void InvalidateValuesUpdateCache ()
 
float processDummyAuras (float TakenTotalMod) const
 
void _addAttacker (Unit *pAttacker)
 
void _removeAttacker (Unit *pAttacker)
 

Private Attributes

uint32 m_state
 
uint32 m_CombatTimer
 
uint32 m_lastManaUse
 
Diminishing m_Diminishing
 
HostileRefMgr m_HostileRefMgr
 
FollowerRefMgr m_FollowingRefMgr
 
Unitm_comboTarget
 
int8 m_comboPoints
 
std::unordered_set< Unit * > m_ComboPointHolders
 
RedirectThreatInfo _redirectThreatInfo
 
bool m_cleanupDone
 
bool m_duringRemoveFromWorld
 
uint32 _oldFactionId
 faction before charm
 
bool _isWalkingBeforeCharm
 Are we walking before we were charmed?
 
uint32 _lastExtraAttackSpell
 
std::unordered_map< ObjectGuid, uint32extraAttacksTargets
 
ObjectGuid _lastDamagedTargetGuid
 
ValuesUpdateCache _valuesUpdateCache
 

Detailed Description

Member Typedef Documentation

◆ AttackerSet

typedef std::unordered_set<Unit*> Unit::AttackerSet

◆ AuraApplicationList

◆ AuraApplicationMap

◆ AuraApplicationMapBounds

typedef std::pair<AuraApplicationMap::const_iterator, AuraApplicationMap::const_iterator> Unit::AuraApplicationMapBounds

◆ AuraApplicationMapBoundsNonConst

typedef std::pair<AuraApplicationMap::iterator, AuraApplicationMap::iterator> Unit::AuraApplicationMapBoundsNonConst

◆ AuraApplicationProcContainer

typedef std::vector<std::pair<uint8 , AuraApplication*> > Unit::AuraApplicationProcContainer

◆ AuraEffectList

typedef std::vector<AuraEffect*> Unit::AuraEffectList

◆ AuraList

typedef std::list<Aura*> Unit::AuraList

◆ AuraMap

typedef std::multimap<uint32, Aura*> Unit::AuraMap

◆ AuraMapBounds

typedef std::pair<AuraMap::const_iterator, AuraMap::const_iterator> Unit::AuraMapBounds

◆ AuraMapBoundsNonConst

typedef std::pair<AuraMap::iterator, AuraMap::iterator> Unit::AuraMapBoundsNonConst

◆ AuraStateAurasMap

◆ AuraStateAurasMapBounds

typedef std::pair<AuraStateAurasMap::const_iterator, AuraStateAurasMap::const_iterator> Unit::AuraStateAurasMapBounds

◆ CharmThreatMap

typedef std::map<ObjectGuid, float> Unit::CharmThreatMap
protected

◆ ComboPointHolderSet

◆ ControlSet

typedef std::set<Unit*> Unit::ControlSet

◆ Diminishing

◆ DynObjectList

typedef std::list<DynamicObject*> Unit::DynObjectList
protected

◆ GameObjectList

typedef GuidList Unit::GameObjectList
protected

◆ PetAuraSet

typedef std::set<PetAura const*> Unit::PetAuraSet

◆ ValuesUpdateCache

typedef std::unordered_map<uint64 , BuildValuesCachedBuffer> Unit::ValuesUpdateCache
private

◆ VisibleAuraMap

Constructor & Destructor Documentation

◆ ~Unit()

Unit::~Unit ( )
override
448{
449 // set current spells as deletable
450 for (uint8 i = 0; i < CURRENT_MAX_SPELL; ++i)
451 if (m_currentSpells[i])
452 {
454 m_currentSpells[i] = nullptr;
455 }
456
458
459 delete i_motionMaster;
460 delete m_charmInfo;
461 delete movespline;
462
465 ASSERT(m_attackers.empty());
466
467 // pussywizard: clear m_sharedVision along with back references
468 if (!m_sharedVision.empty())
469 {
470 do
471 {
472 Player* p = *(m_sharedVision.begin());
473 p->m_isInSharedVisionOf.erase(this);
474 m_sharedVision.remove(p);
475 } while (!m_sharedVision.empty());
476 }
477
478 ASSERT(m_Controlled.empty());
479 ASSERT(m_appliedAuras.empty());
480 ASSERT(m_ownedAuras.empty());
481 ASSERT(m_removedAuras.empty());
482 ASSERT(m_gameObj.empty());
483 ASSERT(m_dynObj.empty());
484
485 if (m_movedByPlayer && m_movedByPlayer != this)
486 LOG_INFO("misc", "Unit::~Unit (A1)");
487
489}
std::uint8_t uint8
Definition Define.h:109
#define ASSERT
Definition Errors.h:68
#define LOG_INFO(filterType__,...)
Definition Log.h:166
#define CURRENT_MAX_SPELL
Definition Unit.h:556
Definition Player.h:1084
std::set< Unit * > m_isInSharedVisionOf
Definition Player.h:2368
void SetReferencedFromCurrent(bool yes)
Definition Spell.h:571
bool m_duringRemoveFromWorld
Definition Unit.h:2233
Spell * m_currentSpells[CURRENT_MAX_SPELL]
Definition Unit.h:2150
AuraList m_removedAuras
Definition Unit.h:2154
ControlSet m_Controlled
Definition Unit.h:2061
Movement::MoveSpline * movespline
Definition Unit.h:2100
CharmInfo * m_charmInfo
Definition Unit.h:2172
MotionMaster * i_motionMaster
Definition Unit.h:2175
void _DeleteRemovedAuras()
Definition Unit.cpp:3952
DynObjectList m_dynObj
Definition Unit.h:2144
SafeUnitPointer m_movedByPlayer
Definition Unit.h:2063
AttackerSet m_attackers
Definition Unit.h:2136
Unit * m_attacking
Definition Unit.h:2137
GameObjectList m_gameObj
Definition Unit.h:2147
AuraMap m_ownedAuras
Definition Unit.h:2152
AuraApplicationMap m_appliedAuras
Definition Unit.h:2153
static void HandleSafeUnitPointersOnDelete(Unit *thisUnit)
Definition Unit.cpp:4481
SharedVisionList m_sharedVision
Definition Unit.h:2173

References _DeleteRemovedAuras(), ASSERT, CURRENT_MAX_SPELL, HandleSafeUnitPointersOnDelete(), i_motionMaster, LOG_INFO, m_appliedAuras, m_attackers, m_attacking, m_charmInfo, m_Controlled, m_currentSpells, m_duringRemoveFromWorld, m_dynObj, m_gameObj, Player::m_isInSharedVisionOf, m_movedByPlayer, m_ownedAuras, m_removedAuras, m_sharedVision, movespline, and Spell::SetReferencedFromCurrent().

◆ Unit()

Unit::Unit ( )
explicitprotected
314 : WorldObject(),
315 m_movedByPlayer(nullptr),
317 IsAIEnabled(false),
318 NeedChangeAI(false),
320 m_CreatedByPlayer(false),
322 i_AI(nullptr),
323 i_disabledAI(nullptr),
324 m_realRace(0),
325 m_race(0),
327 m_procDeep(0),
329 i_motionMaster(new MotionMaster(this)),
330 m_regenTimer(0),
331 m_ThreatMgr(this),
332 m_vehicle(nullptr),
333 m_vehicleKit(nullptr),
335 m_HostileRefMgr(this),
336 m_comboTarget(nullptr),
338{
339#ifdef _MSC_VER
340#pragma warning(default:4355)
341#endif
344
346
353
355
356 m_state = 0;
358
359 for (uint8 i = 0; i < CURRENT_MAX_SPELL; ++i)
360 m_currentSpells[i] = nullptr;
361
362 for (uint8 i = 0; i < MAX_SUMMON_SLOT; ++i)
363 m_SummonSlot[i].Clear();
364
365 for (uint8 i = 0; i < MAX_GAMEOBJECT_SLOT; ++i)
366 m_ObjectSlot[i].Clear();
367
369
370 m_interruptMask = 0;
371 m_transform = 0;
372 m_canModifyStats = false;
373
374 for (uint8 i = 0; i < MAX_SPELL_IMMUNITY; ++i)
375 m_spellImmune[i].clear();
376
377 for (uint8 i = 0; i < UNIT_MOD_END; ++i)
378 {
383 }
384 // implement 50% base damage from offhand
386
387 for (uint8 i = 0; i < MAX_ATTACK; ++i)
388 {
391
392 m_weaponDamage[i][MINDAMAGE][1] = 0.f;
393 m_weaponDamage[i][MAXDAMAGE][1] = 0.f;
394 }
395
396 for (uint8 i = 0; i < MAX_STATS; ++i)
397 m_createStats[i] = 0.0f;
398
399 m_attacking = nullptr;
400 m_modMeleeHitChance = 0.0f;
402 m_modSpellHitChance = 0.0f;
404
405 m_CombatTimer = 0;
406 m_lastManaUse = 0;
407
408 for (uint8 i = 0; i < MAX_SPELL_SCHOOL; ++i)
409 m_threatModifier[i] = 1.0f;
410
411 for (uint8 i = 0; i < MAX_MOVE_TYPE; ++i)
412 m_speed_rate[i] = 1.0f;
413
414 m_charmInfo = nullptr;
415
417
418 // remove aurastates allowing special moves
419 for (uint8 i = 0; i < MAX_REACTIVE; ++i)
420 m_reactiveTimer[i] = 0;
421
422 m_cleanupDone = false;
424
426
427 m_last_notify_position.Relocate(-5000.0f, -5000.0f, -5000.0f, 0.0f);
432
433 m_applyResilience = false;
434 _instantCast = false;
435
436 _lastLiquid = nullptr;
437
438 _oldFactionId = 0;
439
440 _isWalkingBeforeCharm = false;
441
443}
@ TYPEID_UNIT
Definition ObjectGuid.h:35
@ TYPEMASK_UNIT
Definition ObjectGuid.h:49
@ SERVERSIDE_VISIBILITY_GHOST
Definition SharedDefines.h:1285
#define MAX_STATS
Definition SharedDefines.h:276
constexpr auto MAX_SPELL_SCHOOL
Definition SharedDefines.h:303
@ MAX_SUMMON_SLOT
Definition SharedDefines.h:3559
@ GHOST_VISIBILITY_ALIVE
Definition SharedDefines.h:1292
#define MAX_GAMEOBJECT_SLOT
Definition SharedDefines.h:3563
#define MAX_SPELL_IMMUNITY
Definition SharedDefines.h:1415
@ UNIT_MASK_NONE
Definition UnitDefines.h:155
#define MAX_MOVE_TYPE
Definition UnitDefines.h:364
@ BASE_VALUE
Definition Unit.h:128
@ TOTAL_VALUE
Definition Unit.h:129
@ MINDAMAGE
Definition Unit.h:142
@ MAXDAMAGE
Definition Unit.h:143
@ UNIT_MOD_DAMAGE_OFFHAND
Definition Unit.h:173
@ UNIT_MOD_END
Definition Unit.h:175
@ OFF_ATTACK
Definition Unit.h:217
@ MAX_ATTACK
Definition Unit.h:219
@ BASE_ATTACK
Definition Unit.h:216
@ RANGED_ATTACK
Definition Unit.h:218
#define BASE_MAXDAMAGE
Definition Unit.h:42
@ MAX_REACTIVE
Definition Unit.h:618
#define BASE_MINDAMAGE
Definition Unit.h:41
@ TOTAL_PCT
Definition Unit.h:136
@ BASE_PCT
Definition Unit.h:135
@ UPDATEFLAG_LIVING
Definition UpdateData.h:44
@ UPDATEFLAG_STATIONARY_POSITION
Definition UpdateData.h:45
void SetValue(FLAG_TYPE flag, T_VALUES value)
Definition Object.h:394
Definition MotionMaster.h:137
Definition MoveSpline.h:40
uint16 m_objectType
Definition Object.h:251
uint16 m_updateFlag
Definition Object.h:254
TypeID m_objectTypeId
Definition Object.h:253
uint32 m_reactiveTimer[MAX_REACTIVE]
Definition Unit.h:2177
uint32 m_lastSanctuaryTime
Definition Unit.h:2077
LiquidTypeEntry const * _lastLiquid
Definition Unit.h:2188
uint32 m_transform
Definition Unit.h:2148
uint32 m_CombatTimer
Definition Unit.h:2216
bool m_canModifyStats
Definition Unit.h:2167
UnitAI * i_disabledAI
Definition Unit.h:2125
bool NeedChangeAI
Definition Unit.h:2084
uint32 m_state
Definition Unit.h:2215
int32 m_attackTimer[MAX_ATTACK]
Definition Unit.h:2132
float m_modAttackSpeedPct[3]
Definition Unit.h:2074
uint8 m_realRace
Definition Unit.h:2127
Vehicle * m_vehicle
Definition Unit.h:2184
uint8 m_race
Definition Unit.h:2128
UnitAI * i_AI
Definition Unit.h:2124
uint32 _lastExtraAttackSpell
Definition Unit.h:2238
bool _instantCast
Definition Unit.h:2192
ObjectGuid m_ObjectSlot[MAX_GAMEOBJECT_SLOT]
Definition Unit.h:2066
RedirectThreatInfo _redirectThreatInfo
Definition Unit.h:2230
float m_createStats[MAX_STATS]
Definition Unit.h:2134
float m_auraFlatModifiersGroup[UNIT_MOD_END][MODIFIER_TYPE_FLAT_END]
Definition Unit.h:2164
float m_modRangedHitChance
Definition Unit.h:2069
DeathState m_deathState
Definition Unit.h:2139
uint32 m_unitTypeMask
Definition Unit.h:2187
uint32 m_removedAurasCount
Definition Unit.h:2156
ThreatMgr m_ThreatMgr
Definition Unit.h:2180
Unit * m_comboTarget
Definition Unit.h:2226
AuraMap::iterator m_auraUpdateIterator
Definition Unit.h:2155
bool m_AutoRepeatFirstCast
Definition Unit.h:2130
uint16 m_delayed_unit_ai_notify_timer
Definition Unit.h:2096
int32 m_regenTimer
Definition Unit.h:2178
bool bRequestForcedVisibilityUpdate
Definition Unit.h:2097
bool m_ControlledByPlayer
Definition Unit.h:2086
uint32 m_last_notify_mstime
Definition Unit.h:2094
SpellImmuneList m_spellImmune[MAX_SPELL_IMMUNITY]
Definition Unit.h:2076
int8 m_comboPoints
Definition Unit.h:2227
uint32 _oldFactionId
faction before charm
Definition Unit.h:2235
int32 m_baseSpellCritChance
Definition Unit.h:2071
float m_modMeleeHitChance
Definition Unit.h:2068
float m_weaponDamage[MAX_ATTACK][MAX_WEAPON_DAMAGE_RANGE][MAX_ITEM_PROTO_DAMAGES]
Definition Unit.h:2166
Position m_last_notify_position
Definition Unit.h:2093
Vehicle * m_vehicleKit
Definition Unit.h:2185
bool IsAIEnabled
Definition Unit.h:2083
HostileRefMgr m_HostileRefMgr
Definition Unit.h:2222
DualWieldMode _dualWieldMode
Definition Unit.h:2059
bool m_applyResilience
Definition Unit.h:2191
uint32 m_interruptMask
Definition Unit.h:2162
int32 m_procDeep
Definition Unit.h:2141
float m_speed_rate[MAX_MOVE_TYPE]
Definition Unit.h:2170
float m_modSpellHitChance
Definition Unit.h:2070
ObjectGuid m_SummonSlot[MAX_SUMMON_SLOT]
Definition Unit.h:2065
bool m_cleanupDone
Definition Unit.h:2232
bool _isWalkingBeforeCharm
Are we walking before we were charmed?
Definition Unit.h:2236
bool m_CreatedByPlayer
Definition Unit.h:2087
uint16 m_delayed_unit_relocation_timer
Definition Unit.h:2095
float m_threatModifier[MAX_SPELL_SCHOOL]
Definition Unit.h:2073
uint32 m_lastManaUse
Definition Unit.h:2217
float m_auraPctModifiersGroup[UNIT_MOD_END][MODIFIER_TYPE_PCT_END]
Definition Unit.h:2165
WorldObject()
Definition Object.cpp:1032
FlaggedValuesArray32< int32, uint32, ServerSideVisibilityType, TOTAL_SERVERSIDE_VISIBILITY_TYPES > m_serverSideVisibility
Definition Object.h:612
void Relocate(float x, float y)
Definition Position.h:77
Definition ThreatMgr.h:297

References _dualWieldMode, _instantCast, _isWalkingBeforeCharm, _lastExtraAttackSpell, _lastLiquid, _oldFactionId, _redirectThreatInfo, Alive, AUTO, BASE_ATTACK, BASE_MAXDAMAGE, BASE_MINDAMAGE, BASE_PCT, BASE_VALUE, bRequestForcedVisibilityUpdate, CURRENT_MAX_SPELL, GHOST_VISIBILITY_ALIVE, m_applyResilience, m_attacking, m_attackTimer, m_auraFlatModifiersGroup, m_auraPctModifiersGroup, m_auraUpdateIterator, m_baseSpellCritChance, m_canModifyStats, m_charmInfo, m_cleanupDone, m_CombatTimer, m_createStats, m_currentSpells, m_deathState, m_delayed_unit_ai_notify_timer, m_delayed_unit_relocation_timer, m_duringRemoveFromWorld, m_interruptMask, m_last_notify_mstime, m_last_notify_position, m_lastManaUse, m_modAttackSpeedPct, m_modMeleeHitChance, m_modRangedHitChance, m_modSpellHitChance, m_ObjectSlot, Object::m_objectType, Object::m_objectTypeId, m_ownedAuras, m_reactiveTimer, WorldObject::m_serverSideVisibility, m_speed_rate, m_spellImmune, m_state, m_SummonSlot, m_threatModifier, m_transform, Object::m_updateFlag, m_weaponDamage, MAX_ATTACK, MAX_GAMEOBJECT_SLOT, MAX_MOVE_TYPE, MAX_REACTIVE, MAX_SPELL_IMMUNITY, MAX_SPELL_SCHOOL, MAX_STATS, MAX_SUMMON_SLOT, MAXDAMAGE, MINDAMAGE, OFF_ATTACK, RANGED_ATTACK, Position::Relocate(), SERVERSIDE_VISIBILITY_GHOST, FlaggedValuesArray32< T_VALUES, T_FLAGS, FLAG_TYPE, ARRAY_SIZE >::SetValue(), TOTAL_PCT, TOTAL_VALUE, TYPEID_UNIT, TYPEMASK_UNIT, UNIT_MOD_DAMAGE_OFFHAND, UNIT_MOD_END, UPDATEFLAG_LIVING, and UPDATEFLAG_STATIONARY_POSITION.

Member Function Documentation

◆ _addAttacker()

void Unit::_addAttacker ( Unit pAttacker)
inlineprivate
2211{ m_attackers.insert(pAttacker); }

References m_attackers.

Referenced by Attack().

◆ _AddAura()

void Unit::_AddAura ( UnitAura aura,
Unit caster 
)
4639{
4641 m_ownedAuras.insert(AuraMap::value_type(aura->GetId(), aura));
4642
4643 _RemoveNoStackAurasDueToAura(aura, true);
4644
4645 if (aura->IsRemoved())
4646 return;
4647
4649 if (aura->IsSingleTarget())
4650 {
4651 ASSERT((IsInWorld() && !IsDuringRemoveFromWorld()) || (aura->GetCasterGUID() == GetGUID()));
4652 /* @HACK: Player is not in world during loading auras.
4653 * Single target auras are not saved or loaded from database
4654 * but may be created as a result of aura links (player mounts with passengers)
4655 */
4656
4657 // register single target aura
4658 caster->GetSingleCastAuras().push_back(aura);
4659 // remove other single target auras
4660 Unit::AuraList& scAuras = caster->GetSingleCastAuras();
4661 for (Unit::AuraList::iterator itr = scAuras.begin(); itr != scAuras.end();)
4662 {
4663 if ((*itr) != aura &&
4664 (*itr)->IsSingleTargetWith(aura))
4665 {
4666 (*itr)->Remove();
4667 itr = scAuras.begin();
4668 }
4669 else
4670 ++itr;
4671 }
4672 }
4673}
@ SPELL_AURA_CONTROL_VEHICLE
Definition SpellAuraDefines.h:299
ObjectGuid GetCasterGUID() const
Definition SpellAuras.h:105
bool IsRemoved() const
Definition SpellAuras.h:162
bool IsSingleTargetWith(Aura const *aura) const
Definition SpellAuras.cpp:1088
uint32 GetId() const
Definition SpellAuras.cpp:405
bool HasEffectType(AuraType type) const
Definition SpellAuras.cpp:1168
SpellInfo const * GetSpellInfo() const
Definition SpellAuras.h:100
void SetIsSingleTarget(bool val)
Definition SpellAuras.h:167
bool IsSingleTarget() const
Definition SpellAuras.h:165
bool IsInWorld() const
Definition Object.h:108
ObjectGuid GetGUID() const
Definition Object.h:114
bool IsSingleTarget() const
Definition SpellInfo.cpp:1373
void _RemoveNoStackAurasDueToAura(Aura *aura, bool owned)
Definition Unit.cpp:4891
std::list< Aura * > AuraList
Definition Unit.h:675
bool IsDuringRemoveFromWorld() const
Definition Unit.h:697
AuraList & GetSingleCastAuras()
Definition Unit.h:1418

References _RemoveNoStackAurasDueToAura(), ASSERT, Aura::GetCasterGUID(), Object::GetGUID(), Aura::GetId(), GetSingleCastAuras(), Aura::GetSpellInfo(), Aura::HasEffectType(), IsDuringRemoveFromWorld(), Object::IsInWorld(), Aura::IsRemoved(), Aura::IsSingleTarget(), SpellInfo::IsSingleTarget(), Aura::IsSingleTargetWith(), m_cleanupDone, m_ownedAuras, Aura::SetIsSingleTarget(), and SPELL_AURA_CONTROL_VEHICLE.

Referenced by UnitAura::UnitAura().

◆ _ApplyAllAuraStatMods()

void Unit::_ApplyAllAuraStatMods ( )
5714{
5715 for (AuraApplicationMap::iterator i = m_appliedAuras.begin(); i != m_appliedAuras.end(); ++i)
5716 (*i).second->GetBase()->HandleAllEffects(i->second, AURA_EFFECT_HANDLE_STAT, true);
5717}
@ AURA_EFFECT_HANDLE_STAT
Definition SpellAuraDefines.h:46

References AURA_EFFECT_HANDLE_STAT, and m_appliedAuras.

Referenced by Player::_ApplyAllStatBonuses().

◆ _ApplyAura()

void Unit::_ApplyAura ( AuraApplication aurApp,
uint8  effMask 
)
4730{
4731 Aura* aura = aurApp->GetBase();
4732
4733 _RemoveNoStackAurasDueToAura(aura, false);
4734
4735 if (aurApp->GetRemoveMode())
4736 return;
4737
4738 Unit* caster = aura->GetCaster();
4739
4740 // Update target aura state flag
4741 SpellInfo const* spellInfo = aura->GetSpellInfo();
4742 if (AuraStateType aState = spellInfo->GetAuraState())
4743 {
4744 uint32 aStateMask = (1 << (aState - 1));
4745 // force update so the new caster registers it
4746 if ((aStateMask & PER_CASTER_AURA_STATE_MASK) && HasFlag(UNIT_FIELD_AURASTATE, aStateMask))
4748 else
4749 ModifyAuraState(aState, true);
4750 }
4751
4752 if (aurApp->GetRemoveMode())
4753 return;
4754
4755 // Sitdown on apply aura req seated
4758
4759 if (aurApp->GetRemoveMode())
4760 return;
4761
4762 aura->HandleAuraSpecificMods(aurApp, caster, true, false);
4763
4764 // apply effects of the aura
4765 for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
4766 {
4767 if (effMask & 1 << i && (!aurApp->GetRemoveMode()))
4768 aurApp->_HandleEffect(i, true);
4769 }
4770
4771 sScriptMgr->OnAuraApply(this, aura);
4772}
#define MAX_SPELL_EFFECTS
Definition DBCStructure.h:1637
std::uint32_t uint32
Definition Define.h:107
#define sScriptMgr
Definition ScriptMgr.h:725
#define PER_CASTER_AURA_STATE_MASK
Definition SharedDefines.h:1329
AuraStateType
Definition SharedDefines.h:1299
@ AURA_INTERRUPT_FLAG_NOT_SEATED
Definition SpellDefines.h:61
@ UNIT_STAND_STATE_SIT
Definition UnitDefines.h:33
@ UNIT_FIELD_AURASTATE
Definition UpdateFields.h:119
void _HandleEffect(uint8 effIndex, bool apply)
Definition SpellAuras.cpp:161
Aura * GetBase() const
Definition SpellAuras.h:62
AuraRemoveMode GetRemoveMode() const
Definition SpellAuras.h:73
Definition SpellAuras.h:87
Unit * GetCaster() const
Definition SpellAuras.cpp:410
void HandleAuraSpecificMods(AuraApplication const *aurApp, Unit *caster, bool apply, bool onReapply)
Definition SpellAuras.cpp:1211
bool HasFlag(uint16 index, uint32 flag) const
Definition Object.cpp:871
void ForceValuesUpdateAtIndex(uint32)
Definition Object.cpp:2070
Definition SpellInfo.h:316
AuraStateType GetAuraState() const
Definition SpellInfo.cpp:1950
uint32 AuraInterruptFlags
Definition SpellInfo.h:353
Definition Unit.h:658
void ModifyAuraState(AuraStateType flag, bool apply)
Definition Unit.cpp:7486
void SetStandState(uint8 state)
Definition Unit.cpp:13228
bool IsSitState() const
Definition Unit.cpp:13204

References AuraApplication::_HandleEffect(), _RemoveNoStackAurasDueToAura(), AURA_INTERRUPT_FLAG_NOT_SEATED, SpellInfo::AuraInterruptFlags, Object::ForceValuesUpdateAtIndex(), SpellInfo::GetAuraState(), AuraApplication::GetBase(), Aura::GetCaster(), AuraApplication::GetRemoveMode(), Aura::GetSpellInfo(), Aura::HandleAuraSpecificMods(), Object::HasFlag(), IsSitState(), MAX_SPELL_EFFECTS, ModifyAuraState(), PER_CASTER_AURA_STATE_MASK, SetStandState(), sScriptMgr, UNIT_FIELD_AURASTATE, and UNIT_STAND_STATE_SIT.

Referenced by _ApplyAuraEffect().

◆ _ApplyAuraEffect()

void Unit::_ApplyAuraEffect ( Aura aura,
uint8  effIndex 
)
4716{
4717 ASSERT(aura);
4718 ASSERT(aura->HasEffect(effIndex));
4720 ASSERT(aurApp);
4721 if (!aurApp->GetEffectMask())
4722 _ApplyAura(aurApp, 1 << effIndex);
4723 else
4724 aurApp->_HandleEffect(effIndex, true);
4725}
Definition SpellAuras.h:37
uint8 GetEffectMask() const
Definition SpellAuras.h:66
bool HasEffect(uint8 effIndex) const
Definition SpellAuras.h:174
const AuraApplication * GetApplicationOfTarget(ObjectGuid guid) const
Definition SpellAuras.h:184
void _ApplyAura(AuraApplication *aurApp, uint8 effMask)
Definition Unit.cpp:4729

References _ApplyAura(), AuraApplication::_HandleEffect(), ASSERT, Aura::GetApplicationOfTarget(), AuraApplication::GetEffectMask(), Object::GetGUID(), and Aura::HasEffect().

◆ _CreateAuraApplication()

AuraApplication * Unit::_CreateAuraApplication ( Aura aura,
uint8  effMask 
)
4678{
4679 // can't apply aura on unit which is going to be deleted - to not create a memory leak
4681 // aura musn't be removed
4682 ASSERT(!aura->IsRemoved());
4683
4684 // aura mustn't be already applied on target
4685 ASSERT (!aura->IsAppliedOnTarget(GetGUID()) && "Unit::_CreateAuraApplication: aura musn't be applied on target");
4686
4687 SpellInfo const* aurSpellInfo = aura->GetSpellInfo();
4688 uint32 aurId = aurSpellInfo->Id;
4689
4690 // ghost spell check, allow apply any auras at player loading in ghost mode (will be cleanup after load)
4691 // Xinef: Added IsAllowingDeadTarget check
4692 if (!IsAlive() && !aurSpellInfo->IsDeathPersistent() && !aurSpellInfo->IsAllowingDeadTarget() && (!IsPlayer() || !ToPlayer()->GetSession()->PlayerLoading()))
4693 return nullptr;
4694
4695 Unit* caster = aura->GetCaster();
4696
4697 AuraApplication* aurApp = new AuraApplication(this, caster, aura, effMask);
4698 m_appliedAuras.insert(AuraApplicationMap::value_type(aurId, aurApp));
4699
4700 // xinef: do not insert our application to interruptible list if application target is not the owner (area auras)
4701 // xinef: even if it gets removed, it will be reapplied in a second
4702 if (aurSpellInfo->AuraInterruptFlags && this == aura->GetOwner())
4703 {
4704 m_interruptableAuras.push_back(aurApp);
4705 AddInterruptMask(aurSpellInfo->AuraInterruptFlags);
4706 }
4707
4708 if (AuraStateType aState = aura->GetSpellInfo()->GetAuraState())
4709 m_auraStateAuras.insert(AuraStateAurasMap::value_type(aState, aurApp));
4710
4711 aura->_ApplyForTarget(this, caster, aurApp);
4712 return aurApp;
4713}
WorldObject * GetOwner() const
Definition SpellAuras.h:107
bool IsAppliedOnTarget(ObjectGuid guid) const
Definition SpellAuras.h:186
virtual void _ApplyForTarget(Unit *target, Unit *caster, AuraApplication *auraApp)
Definition SpellAuras.cpp:431
bool IsPlayer() const
Definition Object.h:200
Player * ToPlayer()
Definition Object.h:201
bool IsDeathPersistent() const
Definition SpellInfo.cpp:1217
uint32 Id
Definition SpellInfo.h:320
bool IsAllowingDeadTarget() const
Definition SpellInfo.cpp:1227
void AddInterruptMask(uint32 mask)
Definition Unit.h:1593
bool IsAlive() const
Definition Unit.h:1777
AuraApplicationList m_interruptableAuras
Definition Unit.h:2160
AuraStateAurasMap m_auraStateAuras
Definition Unit.h:2161

References Aura::_ApplyForTarget(), AddInterruptMask(), ASSERT, SpellInfo::AuraInterruptFlags, SpellInfo::GetAuraState(), Aura::GetCaster(), Object::GetGUID(), Aura::GetOwner(), Aura::GetSpellInfo(), SpellInfo::Id, IsAlive(), SpellInfo::IsAllowingDeadTarget(), Aura::IsAppliedOnTarget(), SpellInfo::IsDeathPersistent(), Object::IsPlayer(), Aura::IsRemoved(), m_appliedAuras, m_auraStateAuras, m_cleanupDone, m_interruptableAuras, and Object::ToPlayer().

◆ _DeleteRemovedAuras()

void Unit::_DeleteRemovedAuras ( )
protected
3953{
3954 while (!m_removedAuras.empty())
3955 {
3956 delete m_removedAuras.front();
3957 m_removedAuras.pop_front();
3958 }
3959}

References m_removedAuras.

Referenced by _UpdateSpells(), and ~Unit().

◆ _EnterVehicle()

void Unit::_EnterVehicle ( Vehicle vehicle,
int8  seatId,
AuraApplication const *  aurApp = nullptr 
)
15752{
15753 // Must be called only from aura handler
15754 if (!IsAlive() || GetVehicleKit() == vehicle || vehicle->GetBase()->IsOnVehicle(this))
15755 return;
15756
15757 if (m_vehicle)
15758 {
15759 if (m_vehicle == vehicle)
15760 {
15761 if (seatId >= 0 && seatId != GetTransSeat())
15762 {
15763 LOG_DEBUG("vehicles", "EnterVehicle: {} leave vehicle {} seat {} and enter {}.", GetEntry(), m_vehicle->GetBase()->GetEntry(), GetTransSeat(), seatId);
15764 ChangeSeat(seatId);
15765 }
15766
15767 return;
15768 }
15769 else
15770 {
15771 LOG_DEBUG("vehicles", "EnterVehicle: {} exit {} and enter {}.", GetEntry(), m_vehicle->GetBase()->GetEntry(), vehicle->GetBase()->GetEntry());
15772 ExitVehicle();
15773 }
15774 }
15775
15776 if (!aurApp || aurApp->GetRemoveMode())
15777 return;
15778
15779 if (Player* player = ToPlayer())
15780 {
15781 if (vehicle->GetBase()->IsPlayer() && player->IsInCombat())
15782 return;
15783
15784 sScriptMgr->AnticheatSetUnderACKmount(player);
15785
15787 player->StopCastingCharm();
15788 player->StopCastingBindSight();
15789 Dismount();
15791
15792 // drop flag at invisible in bg
15793 if (Battleground* bg = player->GetBattleground())
15794 bg->EventPlayerDroppedFlag(player);
15795
15797 player->SendDirectMessage(&data);
15798 }
15799
15800 ASSERT(!m_vehicle);
15801 m_vehicle = vehicle;
15802
15803 if (!m_vehicle->AddPassenger(this, seatId))
15804 {
15805 m_vehicle = nullptr;
15806 return;
15807 }
15808
15809 // Xinef: remove movement auras when entering vehicle (food buffs etc)
15811}
#define LOG_DEBUG(filterType__,...)
Definition Log.h:170
@ SPELL_AURA_MOUNTED
Definition SpellAuraDefines.h:141
@ AURA_INTERRUPT_FLAG_MOVE
Definition SpellDefines.h:46
@ AURA_INTERRUPT_FLAG_TURNING
Definition SpellDefines.h:47
Definition Battleground.h:294
uint32 GetEntry() const
Definition Object.h:116
void InterruptNonMeleeSpells(bool withDelayed, uint32 spellid=0, bool withInstant=true, bool bySelf=false)
Definition Unit.cpp:4272
void Dismount()
Definition Unit.cpp:10449
bool IsOnVehicle(Unit const *vehicle) const
Definition Unit.h:1910
void RemoveAurasByType(AuraType auraType, ObjectGuid casterGUID=ObjectGuid::Empty, Aura *except=nullptr, bool negative=true, bool positive=true)
Definition Unit.cpp:5335
void ChangeSeat(int8 seatId, bool next=true)
Definition Unit.cpp:15813
Vehicle * GetVehicleKit() const
Definition Unit.h:1908
void RemoveAurasWithInterruptFlags(uint32 flag, uint32 except=0, bool isAutoshot=false)
Definition Unit.cpp:5406
void ExitVehicle(Position const *exitPosition=nullptr)
Definition Unit.cpp:15832
Unit * GetBase() const
May be called from scripts.
Definition Vehicle.h:37
bool AddPassenger(Unit *passenger, int8 seatId=-1)
Definition Vehicle.cpp:319
int8 GetTransSeat() const
Definition Object.h:689
Definition WorldPacket.h:26
@ SMSG_ON_CANCEL_EXPECTED_RIDE_VEHICLE_AURA
Definition Opcodes.h:1211

References Vehicle::AddPassenger(), ASSERT, AURA_INTERRUPT_FLAG_MOVE, AURA_INTERRUPT_FLAG_TURNING, ChangeSeat(), Dismount(), ExitVehicle(), Vehicle::GetBase(), Object::GetEntry(), AuraApplication::GetRemoveMode(), WorldObject::GetTransSeat(), GetVehicleKit(), InterruptNonMeleeSpells(), IsAlive(), IsOnVehicle(), Object::IsPlayer(), LOG_DEBUG, m_vehicle, RemoveAurasByType(), RemoveAurasWithInterruptFlags(), SMSG_ON_CANCEL_EXPECTED_RIDE_VEHICLE_AURA, SPELL_AURA_MOUNTED, sScriptMgr, and Object::ToPlayer().

Referenced by AuraEffect::HandleAuraControlVehicle().

◆ _ExitVehicle()

void Unit::_ExitVehicle ( Position const *  exitPosition = nullptr)
15870{
15871 if (!m_vehicle)
15872 return;
15873
15874 // This should be done before dismiss, because there may be some aura removal
15877
15878 Player* player = ToPlayer();
15879
15880 // If player is on mouted duel and exits the mount should immediatly lose the duel
15881 if (player && player->duel && player->duel->IsMounted)
15882 player->DuelComplete(DUEL_FLED);
15883
15884 Vehicle* vehicle = m_vehicle;
15885 Unit* vehicleBase = m_vehicle->GetBase();
15886 m_vehicle = nullptr;
15887
15888 if (!vehicleBase)
15889 return;
15890
15891 if (IsPlayer())
15893
15894 SetControlled(false, UNIT_STATE_ROOT); // SMSG_MOVE_FORCE_UNROOT, ~MOVEMENTFLAG_ROOT
15895
15896 Position pos;
15897 // If we ask for a specific exit position, use that one. Otherwise allow scripts to modify it
15898 if (exitPosition)
15899 pos = *exitPosition;
15900 else
15901 {
15902 // Set exit position to vehicle position and use the current orientation
15903 pos = vehicleBase->GetPosition(); // This should use passenger's current position, leaving it as it is now
15904 pos.SetOrientation(vehicleBase->GetOrientation());
15905
15906 // Change exit position based on seat entry addon data
15907 if (seatAddon)
15908 {
15910 pos.RelocateOffset({ seatAddon->ExitParameterX, seatAddon->ExitParameterY, seatAddon->ExitParameterZ, seatAddon->ExitParameterO });
15912 pos.Relocate({ seatAddon->ExitParameterX, seatAddon->ExitParameterY, seatAddon->ExitParameterZ, seatAddon->ExitParameterO });
15913 }
15914 }
15915
15917
15918 if (player)
15919 {
15921
15922 sScriptMgr->AnticheatSetUnderACKmount(player);
15923 }
15924
15925 // xinef: hack for flameleviathan seat vehicle
15926 VehicleEntry const* vehicleInfo = vehicle->GetVehicleInfo();
15927 if (!vehicleInfo || vehicleInfo->m_ID != 341)
15928 {
15929 Movement::MoveSplineInit init(this);
15930 init.MoveTo(pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ());
15931 init.SetFacing(vehicleBase->GetOrientation());
15932 init.SetTransportExit();
15933 init.Launch();
15934 }
15935 else
15936 {
15937 float o = pos.GetAngle(this);
15938 Movement::MoveSplineInit init(this);
15939 init.MoveTo(pos.GetPositionX() + 8 * cos(o), pos.GetPositionY() + 8 * std::sin(o), pos.GetPositionZ() + 16.0f);
15940 init.SetFacing(GetOrientation());
15941 init.SetTransportExit();
15942 init.Launch();
15943 DisableSpline();
15944 KnockbackFrom(pos.GetPositionX(), pos.GetPositionY(), 10.0f, 20.0f);
15946 }
15947
15948 // xinef: move fall, should we support all creatures that exited vehicle in air? Currently Quest Drag and Drop only, Air Assault quest
15949 if (IsCreature() && !CanFly() && vehicleInfo && (vehicleInfo->m_ID == 113 || vehicleInfo->m_ID == 8 || vehicleInfo->m_ID == 290 || vehicleInfo->m_ID == 298))
15950 {
15952 }
15953
15954 if ((!player || !(player->GetDelayedOperations() & DELAYED_VEHICLE_TELEPORT)) && vehicle->GetBase()->HasUnitTypeMask(UNIT_MASK_MINION))
15955 if (((Minion*)vehicleBase)->GetOwner() == this)
15956 {
15957 if (!vehicleInfo || vehicleInfo->m_ID != 349)
15958 {
15959 vehicle->Dismiss();
15960 }
15961 else if (vehicleBase->IsCreature())
15962 {
15963 vehicle->Uninstall();
15964 vehicleBase->m_Events.AddEventAtOffset(new VehicleDespawnEvent(*vehicleBase, 2s), 2s);
15965 }
15966
15967 // xinef: ugly hack, no appripriate hook later to cast spell
15968 if (player)
15969 {
15970 if (vehicleBase->GetEntry() == NPC_EIDOLON_WATCHER)
15971 player->CastSpell(player, VEHICLE_SPELL_SHADE_CONTROL_END, true);
15972 else if (vehicleBase->GetEntry() == NPC_LITHE_STALKER)
15973 player->CastSpell(player, VEHICLE_SPELL_GEIST_CONTROL_END, true);
15974 }
15975 }
15976
15978 {
15979 // Vehicle just died, we die too
15980 if (vehicleBase->getDeathState() == DeathState::JustDied)
15982 // If for other reason we as minion are exiting the vehicle (ejected, master dismounted) - unsummon
15983 else
15984 ToTempSummon()->UnSummon(2s); // Approximation
15985 }
15986
15987 if (player)
15988 {
15990 player->SetCanTeleport(true);
15991 }
15992}
@ DELAYED_VEHICLE_TELEPORT
Definition Player.h:902
@ DUEL_FLED
Definition SharedDefines.h:3870
@ UNIT_MASK_ACCESSORY
Definition UnitDefines.h:165
@ UNIT_MASK_MINION
Definition UnitDefines.h:157
@ UNIT_STATE_ROOT
Definition UnitDefines.h:180
@ UNIT_STATE_MOVE
Definition UnitDefines.h:189
@ VEHICLE_SPELL_PARACHUTE
Definition VehicleDefines.h:53
@ VEHICLE_SPELL_SHADE_CONTROL_END
Definition VehicleDefines.h:56
@ VEHICLE_SPELL_GEIST_CONTROL_END
Definition VehicleDefines.h:55
@ NPC_EIDOLON_WATCHER
Definition VehicleDefines.h:69
@ NPC_LITHE_STALKER
Definition VehicleDefines.h:70
void AddEventAtOffset(BasicEvent *event, Milliseconds offset, uint8 eventGroup=0)
Definition EventProcessor.h:108
Definition TemporarySummon.h:87
void MoveFall(uint32 id=0, bool addFlagForNPC=false)
The unit will fall. Used when in the air. Doesn't work with UNIT_FLAG_DISABLE_MOVE.
Definition MotionMaster.cpp:676
Definition MoveSplineInit.h:63
bool IsCreature() const
Definition Object.h:204
void SetCanTeleport(bool value)
Definition Player.h:2531
void DuelComplete(DuelCompleteType type)
Definition Player.cpp:6420
void SetFallInformation(uint32 time, float z)
Definition Player.h:2369
void SetExpectingChangeTransport(bool state)
Definition Player.h:2668
std::unique_ptr< DuelInfo > duel
Definition Player.h:1892
void ResummonPetTemporaryUnSummonedIfAny()
Definition Player.cpp:14237
uint32 GetDelayedOperations() const
Definition Player.h:2115
virtual void UnSummon(Milliseconds msTime=0ms)
Definition TemporarySummon.cpp:292
virtual void setDeathState(DeathState s, bool despawn=false)
Definition Unit.cpp:11433
Unit * GetOwner() const
Definition Unit.cpp:7589
DeathState getDeathState()
Definition Unit.h:1774
virtual bool CanFly() const =0
MotionMaster * GetMotionMaster()
Definition Unit.h:1742
TempSummon * ToTempSummon()
Definition Unit.h:725
void DisableSpline()
Definition Unit.cpp:745
void AddUnitState(uint32 f)
Definition Unit.h:729
void SetControlled(bool apply, UnitState state, Unit *source=nullptr, bool isFear=false)
Definition Unit.cpp:14409
SpellCastResult CastSpell(SpellCastTargets const &targets, SpellInfo const *spellInfo, CustomSpellValues const *value, TriggerCastFlags triggerFlags=TRIGGERED_NONE, Item *castItem=nullptr, AuraEffect const *triggeredByAura=nullptr, ObjectGuid originalCaster=ObjectGuid::Empty)
Definition Unit.cpp:1302
uint32 HasUnitTypeMask(uint32 mask) const
Definition Unit.h:735
void KnockbackFrom(float x, float y, float speedXY, float speedZ)
Definition Unit.cpp:15509
Definition Vehicle.h:102
Definition Vehicle.h:28
void Dismiss()
Definition Vehicle.cpp:542
VehicleEntry const * GetVehicleInfo() const
Definition Vehicle.h:38
void RemovePassenger(Unit *passenger)
Definition Vehicle.cpp:463
void Uninstall()
Definition Vehicle.cpp:102
VehicleSeatAddon const * GetSeatAddonForSeatOfPassenger(Unit const *passenger) const
Definition Vehicle.cpp:238
EventProcessor m_Events
Definition Object.h:731
Seconds GetGameTime()
Definition GameTime.cpp:38
Definition Position.h:27
void RelocateOffset(const Position &offset)
Definition Position.cpp:66
float GetPositionZ() const
Definition Position.h:123
float GetOrientation() const
Definition Position.h:124
void SetOrientation(float orientation)
Definition Position.h:116
float GetPositionX() const
Definition Position.h:121
void GetPosition(float &x, float &y) const
Definition Position.h:126
float GetPositionY() const
Definition Position.h:122
float GetAngle(const Position *pos) const
Definition Position.cpp:85
Definition DBCStructure.h:2027
uint32 m_ID
Definition DBCStructure.h:2028
Definition VehicleDefines.h:86
float ExitParameterO
Definition VehicleDefines.h:96
float ExitParameterX
Definition VehicleDefines.h:93
float ExitParameterY
Definition VehicleDefines.h:94
float ExitParameterZ
Definition VehicleDefines.h:95
VehicleExitParameters ExitParameter
Definition VehicleDefines.h:97

References EventProcessor::AddEventAtOffset(), AddUnitState(), CanFly(), CastSpell(), DELAYED_VEHICLE_TELEPORT, DisableSpline(), Vehicle::Dismiss(), Player::duel, DUEL_FLED, Player::DuelComplete(), VehicleSeatAddon::ExitParameter, VehicleSeatAddon::ExitParameterO, VehicleSeatAddon::ExitParameterX, VehicleSeatAddon::ExitParameterY, VehicleSeatAddon::ExitParameterZ, Position::GetAngle(), Vehicle::GetBase(), getDeathState(), Player::GetDelayedOperations(), Object::GetEntry(), GameTime::GetGameTime(), GetMotionMaster(), Position::GetOrientation(), GetOwner(), Position::GetPosition(), Position::GetPositionX(), Position::GetPositionY(), Position::GetPositionZ(), Vehicle::GetSeatAddonForSeatOfPassenger(), Vehicle::GetVehicleInfo(), HasUnitTypeMask(), Object::IsCreature(), Object::IsPlayer(), JustDied, KnockbackFrom(), Movement::MoveSplineInit::Launch(), WorldObject::m_Events, VehicleEntry::m_ID, m_vehicle, MotionMaster::MoveFall(), Movement::MoveSplineInit::MoveTo(), NPC_EIDOLON_WATCHER, NPC_LITHE_STALKER, Position::Relocate(), Position::RelocateOffset(), Vehicle::RemovePassenger(), Player::ResummonPetTemporaryUnSummonedIfAny(), Player::SetCanTeleport(), SetControlled(), setDeathState(), Player::SetExpectingChangeTransport(), Movement::MoveSplineInit::SetFacing(), Player::SetFallInformation(), Position::SetOrientation(), Movement::MoveSplineInit::SetTransportExit(), sScriptMgr, Object::ToPlayer(), ToTempSummon(), Vehicle::Uninstall(), UNIT_MASK_ACCESSORY, UNIT_MASK_MINION, UNIT_STATE_MOVE, UNIT_STATE_ROOT, TempSummon::UnSummon(), VEHICLE_SPELL_GEIST_CONTROL_END, VEHICLE_SPELL_PARACHUTE, VEHICLE_SPELL_SHADE_CONTROL_END, VehicleExitParamDest, and VehicleExitParamOffset.

Referenced by AuraEffect::HandleAuraControlVehicle(), and boss_mimiron::UpdateAI().

◆ _IsNoStackAuraDueToAura()

bool Unit::_IsNoStackAuraDueToAura ( Aura appliedAura,
Aura existingAura 
) const

◆ _IsValidAssistTarget()

bool Unit::_IsValidAssistTarget ( Unit const *  target,
SpellInfo const *  bySpell 
) const
10949{
10950 ASSERT(target);
10951
10952 // can assist to self
10953 if (this == target)
10954 return true;
10955
10956 // can't assist unattackable units or GMs
10957 if (target->HasUnitState(UNIT_STATE_UNATTACKABLE)
10958 || (target->IsPlayer() && target->ToPlayer()->IsGameMaster()))
10959 return false;
10960
10961 // can't assist own vehicle or passenger
10962 if (m_vehicle)
10963 if (IsOnVehicle(target) || m_vehicle->GetBase()->IsOnVehicle(target))
10964 return false;
10965
10966 // can't assist invisible
10967 if ((!bySpell || !bySpell->HasAttribute(SPELL_ATTR6_IGNORE_PHASE_SHIFT)) && !CanSeeOrDetect(target, bySpell && bySpell->IsAffectingArea()))
10968 return false;
10969
10970 // can't assist dead
10971 if ((!bySpell || !bySpell->IsAllowingDeadTarget()) && !target->IsAlive())
10972 return false;
10973
10974 // can't assist untargetable
10975 if ((!bySpell || !bySpell->HasAttribute(SPELL_ATTR6_CAN_TARGET_UNTARGETABLE))
10976 && target->HasUnitFlag(UNIT_FLAG_NOT_SELECTABLE))
10977 return false;
10978
10979 if (!bySpell || !bySpell->HasAttribute(SPELL_ATTR6_CAN_ASSIST_IMMUNE_PC))
10980 {
10981 // xinef: do not allow to assist non attackable units
10982 if (target->HasUnitFlag(UNIT_FLAG_NON_ATTACKABLE))
10983 return false;
10984
10986 {
10987 if (target->IsImmuneToPC())
10988 return false;
10989 }
10990 else
10991 {
10992 if (target->IsImmuneToNPC())
10993 return false;
10994 }
10995 }
10996
10997 // can't assist non-friendly targets
10998 if (GetReactionTo(target) < REP_NEUTRAL
10999 && target->GetReactionTo(this) < REP_NEUTRAL
11000 && (!ToCreature() || !(ToCreature()->GetCreatureTemplate()->type_flags & CREATURE_TYPE_FLAG_TREAT_AS_RAID_UNIT)))
11001 return false;
11002
11003 // PvP case
11004 if (target->HasUnitFlag(UNIT_FLAG_PLAYER_CONTROLLED))
11005 {
11006 Player const* targetPlayerOwner = target->GetAffectingPlayer();
11008 {
11009 Player const* selfPlayerOwner = GetAffectingPlayer();
11010 if (selfPlayerOwner && targetPlayerOwner)
11011 {
11012 // can't assist player which is dueling someone
11013 if (selfPlayerOwner != targetPlayerOwner
11014 && targetPlayerOwner->duel)
11015 return false;
11016 }
11017 // can't assist player in ffa_pvp zone from outside
11018 if (target->IsFFAPvP() && !IsFFAPvP())
11019 return false;
11020
11021 // can't assist player out of sanctuary from sanctuary if has pvp enabled
11022 if (target->IsPvP())
11023 if (IsInSanctuary() && !target->IsInSanctuary())
11024 return false;
11025 }
11026 }
11027 // PvC case - player can assist creature only if has specific type flags
11028 // !target->HasUnitFlag(UNIT_FLAG_PLAYER_CONTROLLED) &&
11030 && (!bySpell || !bySpell->HasAttribute(SPELL_ATTR6_CAN_ASSIST_IMMUNE_PC))
11031 && !target->IsPvP())
11032 {
11033 if (Creature const* creatureTarget = target->ToCreature())
11034 return creatureTarget->GetCreatureTemplate()->type_flags & CREATURE_TYPE_FLAG_TREAT_AS_RAID_UNIT || creatureTarget->GetCreatureTemplate()->type_flags & CREATURE_TYPE_FLAG_CAN_ASSIST;
11035 }
11036 return true;
11037}
@ REP_NEUTRAL
Definition SharedDefines.h:183
@ CREATURE_TYPE_FLAG_TREAT_AS_RAID_UNIT
Definition SharedDefines.h:2722
@ CREATURE_TYPE_FLAG_CAN_ASSIST
Definition SharedDefines.h:2708
@ SPELL_ATTR6_CAN_TARGET_UNTARGETABLE
Definition SharedDefines.h:639
@ SPELL_ATTR6_IGNORE_PHASE_SHIFT
Definition SharedDefines.h:628
@ SPELL_ATTR6_CAN_ASSIST_IMMUNE_PC
Definition SharedDefines.h:618
@ UNIT_STATE_UNATTACKABLE
Definition UnitDefines.h:211
@ UNIT_FLAG_NON_ATTACKABLE
Definition UnitDefines.h:255
@ UNIT_FLAG_NOT_SELECTABLE
Definition UnitDefines.h:279
@ UNIT_FLAG_PLAYER_CONTROLLED
Definition UnitDefines.h:257
Definition Creature.h:47
Creature * ToCreature()
Definition Object.h:205
ReputationRank GetReactionTo(Unit const *target, bool checkOriginalFaction=false) const
Definition Unit.cpp:7028
bool HasUnitFlag(UnitFlags flags) const
Definition Unit.h:741
bool IsInSanctuary() const
Definition Unit.h:1032
bool IsFFAPvP() const
Definition Unit.h:1034
Player * GetAffectingPlayer() const
Definition Unit.cpp:7614
bool CanSeeOrDetect(WorldObject const *obj, bool ignoreStealth=false, bool distanceCheck=false, bool checkAlert=false) const
Definition Object.cpp:1726

References ASSERT, WorldObject::CanSeeOrDetect(), CREATURE_TYPE_FLAG_CAN_ASSIST, CREATURE_TYPE_FLAG_TREAT_AS_RAID_UNIT, Player::duel, GetAffectingPlayer(), Vehicle::GetBase(), GetReactionTo(), SpellInfo::HasAttribute(), HasUnitFlag(), HasUnitState(), SpellInfo::IsAffectingArea(), IsAlive(), SpellInfo::IsAllowingDeadTarget(), IsFFAPvP(), Player::IsGameMaster(), IsImmuneToNPC(), IsImmuneToPC(), IsInSanctuary(), IsOnVehicle(), Object::IsPlayer(), IsPvP(), m_vehicle, REP_NEUTRAL, SPELL_ATTR6_CAN_ASSIST_IMMUNE_PC, SPELL_ATTR6_CAN_TARGET_UNTARGETABLE, SPELL_ATTR6_IGNORE_PHASE_SHIFT, Object::ToCreature(), Object::ToPlayer(), UNIT_FLAG_NON_ATTACKABLE, UNIT_FLAG_NOT_SELECTABLE, UNIT_FLAG_PLAYER_CONTROLLED, and UNIT_STATE_UNATTACKABLE.

Referenced by SpellInfo::CheckExplicitTarget(), IsValidAssistTarget(), and Acore::WorldObjectSpellTargetCheck::operator()().

◆ _IsValidAttackTarget()

bool Unit::_IsValidAttackTarget ( Unit const *  target,
SpellInfo const *  bySpell,
WorldObject const *  obj = nullptr 
) const
10811{
10812 ASSERT(target);
10813
10814 // can't attack self
10815 if (this == target)
10816 return false;
10817
10818 // can't attack unattackable units or GMs
10819 if (target->HasUnitState(UNIT_STATE_UNATTACKABLE)
10820 || (target->IsPlayer() && target->ToPlayer()->IsGameMaster()))
10821 return false;
10822
10823 // can't attack own vehicle or passenger
10824 if (m_vehicle)
10825 if (IsOnVehicle(target) || m_vehicle->GetBase()->IsOnVehicle(target))
10826 if (!IsHostileTo(target)) // pussywizard: actually can attack own vehicle or passenger if it's hostile to us - needed for snobold in Gormok encounter
10827 return false;
10828
10829 // can't attack invisible (ignore stealth for aoe spells) also if the area being looked at is from a spell use the dynamic object created instead of the casting unit.
10830 //Ignore stealth if target is player and unit in combat with same player
10831 if ((!bySpell || !bySpell->HasAttribute(SPELL_ATTR6_IGNORE_PHASE_SHIFT)) && (obj ? !obj->CanSeeOrDetect(target, bySpell && bySpell->IsAffectingArea()) : !CanSeeOrDetect(target, (bySpell && bySpell->IsAffectingArea()) || (target->IsPlayer() && target->HasStealthAura() && target->IsInCombat() && IsInCombatWith(target)))))
10832 return false;
10833
10834 // can't attack dead
10835 if ((!bySpell || !bySpell->IsAllowingDeadTarget()) && !target->IsAlive())
10836 return false;
10837
10838 // can't attack untargetable
10839 if ((!bySpell || !bySpell->HasAttribute(SPELL_ATTR6_CAN_TARGET_UNTARGETABLE))
10840 && target->HasUnitFlag(UNIT_FLAG_NOT_SELECTABLE))
10841 return false;
10842
10843 if (Player const* playerAttacker = ToPlayer())
10844 {
10845 if (playerAttacker->HasPlayerFlag(PLAYER_FLAGS_UBER) || playerAttacker->IsSpectator())
10846 return false;
10847 }
10848 // check flags
10850 || (!HasUnitFlag(UNIT_FLAG_PLAYER_CONTROLLED) && target->IsImmuneToNPC())
10851 || (!target->HasUnitFlag(UNIT_FLAG_PLAYER_CONTROLLED) && IsImmuneToNPC())
10852 || (HasUnitFlag(UNIT_FLAG_PLAYER_CONTROLLED) && target->IsImmuneToPC())
10853 // check if this is a world trigger cast - GOs are using world triggers to cast their spells, so we need to ignore their immunity flag here, this is a temp workaround, needs removal when go cast is implemented properly
10854 || ((GetEntry() != WORLD_TRIGGER && (!obj || !obj->isType(TYPEMASK_GAMEOBJECT | TYPEMASK_DYNAMICOBJECT))) && target->HasUnitFlag(UNIT_FLAG_PLAYER_CONTROLLED) && IsImmuneToPC()))
10855 return false;
10856
10857 // CvC case - can attack each other only when one of them is hostile
10859 return GetReactionTo(target) <= REP_HOSTILE || target->GetReactionTo(this) <= REP_HOSTILE;
10860
10861 // PvP, PvC, CvP case
10862 // can't attack friendly targets
10863 ReputationRank repThisToTarget = GetReactionTo(target);
10864 ReputationRank repTargetToThis;
10865
10866 if (repThisToTarget > REP_NEUTRAL
10867 || (repTargetToThis = target->GetReactionTo(this)) > REP_NEUTRAL)
10868 {
10869 // contested guards can attack contested PvP players even though players may be friendly
10870 if (!target->IsControlledByPlayer())
10871 return false;
10872
10873 bool isContestedGuard = false;
10874 if (FactionTemplateEntry const* entry = GetFactionTemplateEntry())
10875 isContestedGuard = entry->factionFlags & FACTION_TEMPLATE_FLAG_ATTACK_PVP_ACTIVE_PLAYERS;
10876
10877 bool isContestedPvp = false;
10878 if (Player const* player = target->GetCharmerOrOwnerPlayerOrPlayerItself())
10879 isContestedPvp = player->HasPlayerFlag(PLAYER_FLAGS_CONTESTED_PVP);
10880
10881 if (!isContestedGuard && !isContestedPvp)
10882 return false;
10883 }
10884
10885 // Not all neutral creatures can be attacked (even some unfriendly faction does not react aggresive to you, like Sporaggar)
10886 if (repThisToTarget == REP_NEUTRAL &&
10887 repTargetToThis <= REP_NEUTRAL)
10888 {
10889 Player* owner = GetAffectingPlayer();
10890 Unit const* const thisUnit = owner ? owner : this;
10891 if (!(target->IsPlayer() && thisUnit->IsPlayer()) &&
10892 !(target->IsCreature() && thisUnit->IsCreature()))
10893 {
10894 Player const* player = target->IsPlayer() ? target->ToPlayer() : thisUnit->ToPlayer();
10895 Unit const* creature = target->IsCreature() ? target : thisUnit;
10896
10897 if (FactionTemplateEntry const* factionTemplate = creature->GetFactionTemplateEntry())
10898 {
10899 if (!(player->GetReputationMgr().GetForcedRankIfAny(factionTemplate)))
10900 if (FactionEntry const* factionEntry = sFactionStore.LookupEntry(factionTemplate->faction))
10901 if (FactionState const* repState = player->GetReputationMgr().GetState(factionEntry))
10902 if (!(repState->Flags & FACTION_FLAG_AT_WAR))
10903 return false;
10904 }
10905 }
10906 }
10907
10908 Creature const* creatureAttacker = ToCreature();
10909 if (creatureAttacker && creatureAttacker->GetCreatureTemplate()->type_flags & CREATURE_TYPE_FLAG_TREAT_AS_RAID_UNIT)
10910 return false;
10911
10912 Player const* playerAffectingAttacker = HasUnitFlag(UNIT_FLAG_PLAYER_CONTROLLED) ? GetAffectingPlayer() : nullptr;
10913 Player const* playerAffectingTarget = target->HasUnitFlag(UNIT_FLAG_PLAYER_CONTROLLED) ? target->GetAffectingPlayer() : nullptr;
10914
10915 // check duel - before sanctuary checks
10916 if (playerAffectingAttacker && playerAffectingTarget)
10917 if (playerAffectingAttacker->duel && playerAffectingAttacker->duel->Opponent == playerAffectingTarget && playerAffectingAttacker->duel->State == DUEL_STATE_IN_PROGRESS)
10918 return true;
10919
10920 // PvP case - can't attack when attacker or target are in sanctuary
10921 // however, 13850 client doesn't allow to attack when one of the unit's has sanctuary flag and is pvp
10922 if (target->HasUnitFlag(UNIT_FLAG_PLAYER_CONTROLLED) && HasUnitFlag(UNIT_FLAG_PLAYER_CONTROLLED) && (target->IsInSanctuary() || IsInSanctuary()))
10923 return false;
10924
10925 // additional checks - only PvP case
10926 if (playerAffectingAttacker && playerAffectingTarget)
10927 {
10928 if (!IsPvP() && bySpell && bySpell->IsAffectingArea() && !bySpell->HasAttribute(SPELL_ATTR5_IGNORE_AREA_EFFECT_PVP_CHECK))
10929 return false;
10930
10931 if (target->IsPvP())
10932 return true;
10933
10934 if (IsFFAPvP() && target->IsFFAPvP())
10935 return true;
10936
10938 }
10939 return true;
10940}
@ FACTION_FLAG_AT_WAR
Definition DBCEnums.h:308
@ FACTION_TEMPLATE_FLAG_ATTACK_PVP_ACTIVE_PLAYERS
Definition DBCEnums.h:331
DBCStorage< FactionEntry > sFactionStore(FactionEntryfmt)
@ TYPEMASK_DYNAMICOBJECT
Definition ObjectGuid.h:52
@ TYPEMASK_GAMEOBJECT
Definition ObjectGuid.h:51
@ DUEL_STATE_IN_PROGRESS
Definition Player.h:359
@ PLAYER_FLAGS_CONTESTED_PVP
Definition Player.h:467
@ PLAYER_FLAGS_UBER
Definition Player.h:478
@ SPELL_ATTR5_IGNORE_AREA_EFFECT_PVP_CHECK
Definition SharedDefines.h:584
ReputationRank
Definition SharedDefines.h:179
@ REP_HOSTILE
Definition SharedDefines.h:181
@ UNIT_BYTE2_FLAG_UNK1
Definition UnitDefines.h:137
@ UNIT_FLAG_TAXI_FLIGHT
Definition UnitDefines.h:274
@ UNIT_FLAG_NON_ATTACKABLE_2
Definition UnitDefines.h:270
@ UNIT_FLAG_NOT_ATTACKABLE_1
Definition UnitDefines.h:261
#define WORLD_TRIGGER
Definition Unit.h:39
@ UNIT_FIELD_BYTES_2
Definition UpdateFields.h:161
CreatureTemplate const * GetCreatureTemplate() const
Definition Creature.h:205
bool HasByteFlag(uint16 index, uint8 offset, uint8 flag) const
Definition Object.cpp:931
ReputationMgr & GetReputationMgr()
Definition Player.h:2142
FactionState const * GetState(FactionEntry const *factionEntry) const
Definition ReputationMgr.h:81
ReputationRank const * GetForcedRankIfAny(FactionTemplateEntry const *factionTemplateEntry) const
Definition ReputationMgr.h:106
FactionTemplateEntry const * GetFactionTemplateEntry() const
Definition Unit.cpp:6998
Player * GetCharmerOrOwnerPlayerOrPlayerItself() const
Definition Unit.cpp:7605
bool IsPvP() const
Definition Unit.h:1033
bool HasStealthAura() const
Definition Unit.h:1825
bool IsInCombatWith(Unit const *who) const
Definition Unit.cpp:17249
bool IsImmuneToNPC() const
Definition Unit.h:923
bool IsHostileTo(Unit const *unit) const
Definition Unit.cpp:7200
bool IsImmuneToPC() const
Definition Unit.h:921
bool IsInCombat() const
Definition Unit.h:928
uint32 type_flags
Definition CreatureData.h:219
Definition DBCStructure.h:907
Definition ReputationMgr.h:41
Definition DBCStructure.h:939

References ASSERT, WorldObject::CanSeeOrDetect(), CREATURE_TYPE_FLAG_TREAT_AS_RAID_UNIT, Player::duel, DUEL_STATE_IN_PROGRESS, FACTION_FLAG_AT_WAR, FACTION_TEMPLATE_FLAG_ATTACK_PVP_ACTIVE_PLAYERS, GetAffectingPlayer(), Vehicle::GetBase(), GetCharmerOrOwnerPlayerOrPlayerItself(), Creature::GetCreatureTemplate(), Object::GetEntry(), GetFactionTemplateEntry(), ReputationMgr::GetForcedRankIfAny(), GetReactionTo(), Player::GetReputationMgr(), ReputationMgr::GetState(), SpellInfo::HasAttribute(), Object::HasByteFlag(), HasStealthAura(), HasUnitFlag(), HasUnitState(), SpellInfo::IsAffectingArea(), IsAlive(), SpellInfo::IsAllowingDeadTarget(), IsControlledByPlayer(), Object::IsCreature(), IsFFAPvP(), Player::IsGameMaster(), IsHostileTo(), IsImmuneToNPC(), IsImmuneToPC(), IsInCombat(), IsInCombatWith(), IsInSanctuary(), IsOnVehicle(), Object::IsPlayer(), IsPvP(), Object::isType(), m_vehicle, PLAYER_FLAGS_CONTESTED_PVP, PLAYER_FLAGS_UBER, REP_HOSTILE, REP_NEUTRAL, sFactionStore, SPELL_ATTR5_IGNORE_AREA_EFFECT_PVP_CHECK, SPELL_ATTR6_CAN_TARGET_UNTARGETABLE, SPELL_ATTR6_IGNORE_PHASE_SHIFT, Object::ToCreature(), Object::ToPlayer(), CreatureTemplate::type_flags, TYPEMASK_DYNAMICOBJECT, TYPEMASK_GAMEOBJECT, UNIT_BYTE2_FLAG_UNK1, UNIT_FIELD_BYTES_2, UNIT_FLAG_NON_ATTACKABLE, UNIT_FLAG_NON_ATTACKABLE_2, UNIT_FLAG_NOT_ATTACKABLE_1, UNIT_FLAG_NOT_SELECTABLE, UNIT_FLAG_PLAYER_CONTROLLED, UNIT_FLAG_TAXI_FLIGHT, UNIT_STATE_UNATTACKABLE, and WORLD_TRIGGER.

Referenced by SpellInfo::CheckExplicitTarget(), Spell::DoSpellHitOnUnit(), GetMagicHitRedirectTarget(), GetMeleeHitRedirectTarget(), IsValidAttackTarget(), Acore::AnyAoETargetUnitInObjectRangeCheck::operator()(), and Acore::WorldObjectSpellTargetCheck::operator()().

◆ _RegisterAuraEffect()

void Unit::_RegisterAuraEffect ( AuraEffect aurEff,
bool  apply 
)
4915{
4916 if (apply)
4917 m_modAuras[aurEff->GetAuraType()].push_back(aurEff);
4918 else
4919 m_modAuras[aurEff->GetAuraType()].erase(std::remove(m_modAuras[aurEff->GetAuraType()].begin(), m_modAuras[aurEff->GetAuraType()].end(), aurEff), m_modAuras[aurEff->GetAuraType()].end());
4920}
AuraType GetAuraType() const
Definition SpellAuraEffects.cpp:447
AuraEffectList m_modAuras[TOTAL_AURAS]
Definition Unit.h:2158

References AuraEffect::GetAuraType(), and m_modAuras.

Referenced by AuraEffect::HandleEffect().

◆ _RegisterDynObject()

void Unit::_RegisterDynObject ( DynamicObject dynObj)
6452{
6453 m_dynObj.push_back(dynObj);
6454}

References m_dynObj.

Referenced by DynamicObject::BindToCaster().

◆ _RemoveAllAuraStatMods()

void Unit::_RemoveAllAuraStatMods ( )
5708{
5709 for (AuraApplicationMap::iterator i = m_appliedAuras.begin(); i != m_appliedAuras.end(); ++i)
5710 (*i).second->GetBase()->HandleAllEffects(i->second, AURA_EFFECT_HANDLE_STAT, false);
5711}

References AURA_EFFECT_HANDLE_STAT, and m_appliedAuras.

Referenced by Player::_RemoveAllStatBonuses().

◆ _removeAttacker()

void Unit::_removeAttacker ( Unit pAttacker)
inlineprivate
Note
: Call only in Unit::Attack()
2212{ m_attackers.erase(pAttacker); }

References m_attackers.

Referenced by Attack(), and AttackStop().

◆ _RemoveNoStackAuraApplicationsDueToAura()

void Unit::_RemoveNoStackAuraApplicationsDueToAura ( Aura aura)

◆ _RemoveNoStackAurasDueToAura()

void Unit::_RemoveNoStackAurasDueToAura ( Aura aura,
bool  owned 
)
4892{
4893 //SpellInfo const* spellProto = aura->GetSpellInfo();
4894
4895 // passive spell special case (only non stackable with ranks)
4896
4897 // xinef: this check makes caster to have 2 area auras thanks to spec switch
4898 // if (spellProto->IsPassiveStackableWithRanks())
4899 // return;
4900
4901 ASSERT(aura);
4902 if (!IsHighestExclusiveAura(aura))
4903 {
4904 aura->Remove();
4905 return;
4906 }
4907
4908 if (owned)
4909 RemoveOwnedAuras([aura](Aura const* ownedAura) { return !aura->CanStackWith(ownedAura); });
4910 else
4911 RemoveAppliedAuras([aura](AuraApplication const* appliedAura) { return !aura->CanStackWith(appliedAura->GetBase()); });
4912}
bool CanStackWith(Aura const *existingAura) const
Definition SpellAuras.cpp:1956
virtual void Remove(AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)=0
void RemoveAppliedAuras(std::function< bool(AuraApplication const *)> const &check)
Definition Unit.cpp:5088
void RemoveOwnedAuras(std::function< bool(Aura const *)> const &check)
Definition Unit.cpp:5075
bool IsHighestExclusiveAura(Aura const *aura, bool removeOtherAuraApplications=false)
Definition Unit.cpp:4530

References ASSERT, Aura::CanStackWith(), AuraApplication::GetBase(), IsHighestExclusiveAura(), Aura::Remove(), RemoveAppliedAuras(), and RemoveOwnedAuras().

Referenced by _AddAura(), and _ApplyAura().

◆ _TryStackingOrRefreshingExistingAura()

Aura * Unit::_TryStackingOrRefreshingExistingAura ( SpellInfo const *  newAura,
uint8  effMask,
Unit caster,
int32 baseAmount = nullptr,
Item castItem = nullptr,
ObjectGuid  casterGUID = ObjectGuid::Empty,
bool  periodicReset = false 
)
4580{
4581 ASSERT(casterGUID || caster);
4582 if (!casterGUID)
4583 casterGUID = caster->GetGUID();
4584
4585 // passive and Incanter's Absorption and auras with different type can stack with themselves any number of times
4586 if (!newAura->IsMultiSlotAura())
4587 {
4588 // check if cast item changed
4589 ObjectGuid castItemGUID;
4590 if (castItem)
4591 castItemGUID = castItem->GetGUID();
4592
4593 // find current aura from spell and change it's stackamount, or refresh it's duration
4594 // Use castItemGUID for passive auras (weapon imbues) and enchant procs so they can stack from dual-wield
4595 bool useItemGuid = newAura->IsPassive() || newAura->HasAttribute(SPELL_ATTR0_CU_ENCHANT_PROC);
4596 ObjectGuid itemGuidForLookup = (useItemGuid && castItemGUID) ? castItemGUID : ObjectGuid::Empty;
4597 if (Aura* foundAura = GetOwnedAura(newAura->Id, newAura->HasAttribute(SPELL_ATTR0_CU_SINGLE_AURA_STACK) ? ObjectGuid::Empty : casterGUID, itemGuidForLookup, 0))
4598 {
4599 // effect masks do not match
4600 // extremely rare case
4601 // let's just recreate aura
4602 if (effMask != foundAura->GetEffectMask())
4603 return nullptr;
4604
4605 // update basepoints with new values - effect amount will be recalculated in ModStackAmount
4606 for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
4607 {
4608 if (!foundAura->HasEffect(i))
4609 continue;
4610
4611 int bp;
4612 if (baseAmount)
4613 bp = *(baseAmount + i);
4614 else
4615 bp = foundAura->GetSpellInfo()->Effects[i].BasePoints;
4616
4617 int32* oldBP = const_cast<int32*>(&(foundAura->GetEffect(i)->m_baseAmount));
4618 *oldBP = bp;
4619 }
4620
4621 // correct cast item guid if needed
4622 if (castItemGUID != foundAura->GetCastItemGUID())
4623 {
4624 ObjectGuid* oldGUID = const_cast<ObjectGuid*>(&foundAura->m_castItemGuid);
4625 *oldGUID = castItemGUID;
4626 }
4627
4628 // try to increase stack amount
4629 foundAura->ModStackAmount(1, AURA_REMOVE_BY_DEFAULT, periodicReset);
4630 sScriptMgr->OnAuraApply(this, foundAura);
4631 return foundAura;
4632 }
4633 }
4634
4635 return nullptr;
4636}
std::int32_t int32
Definition Define.h:103
@ AURA_REMOVE_BY_DEFAULT
Definition SpellAuraDefines.h:392
@ SPELL_ATTR0_CU_ENCHANT_PROC
Definition SpellInfo.h:176
@ SPELL_ATTR0_CU_SINGLE_AURA_STACK
Definition SpellInfo.h:198
Definition ObjectGuid.h:118
static ObjectGuid const Empty
Definition ObjectGuid.h:120
static ObjectGuid GetGUID(Object const *o)
Definition Object.h:113
Aura * GetOwnedAura(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint8 reqEffMask=0, Aura *except=nullptr) const
Definition Unit.cpp:4978

References ASSERT, AURA_REMOVE_BY_DEFAULT, ObjectGuid::Empty, Object::GetGUID(), GetOwnedAura(), SpellInfo::HasAttribute(), SpellInfo::Id, SpellInfo::IsMultiSlotAura(), SpellInfo::IsPassive(), MAX_SPELL_EFFECTS, SPELL_ATTR0_CU_ENCHANT_PROC, SPELL_ATTR0_CU_SINGLE_AURA_STACK, and sScriptMgr.

Referenced by Aura::TryRefreshStackOrCreate().

◆ _UnapplyAura() [1/2]

void Unit::_UnapplyAura ( AuraApplication aurApp,
AuraRemoveMode  removeMode 
)
4871{
4872 // aura can be removed from unit only if it's applied on it, shouldn't happen
4873 ASSERT(aurApp->GetBase()->GetApplicationOfTarget(GetGUID()) == aurApp);
4874
4875 uint32 spellId = aurApp->GetBase()->GetId();
4876 AuraApplicationMapBoundsNonConst range = m_appliedAuras.equal_range(spellId);
4877
4878 for (AuraApplicationMap::iterator iter = range.first; iter != range.second;)
4879 {
4880 if (iter->second == aurApp)
4881 {
4882 _UnapplyAura(iter, removeMode);
4883 return;
4884 }
4885 else
4886 ++iter;
4887 }
4888 ABORT();
4889}
#define ABORT
Definition Errors.h:76
std::pair< AuraApplicationMap::iterator, AuraApplicationMap::iterator > AuraApplicationMapBoundsNonConst
Definition Unit.h:669
void _UnapplyAura(AuraApplicationMap::iterator &i, AuraRemoveMode removeMode)
Definition Unit.cpp:4775

References _UnapplyAura(), ABORT, ASSERT, Aura::GetApplicationOfTarget(), AuraApplication::GetBase(), Object::GetGUID(), Aura::GetId(), and m_appliedAuras.

◆ _UnapplyAura() [2/2]

void Unit::_UnapplyAura ( AuraApplicationMap::iterator &  i,
AuraRemoveMode  removeMode 
)
4776{
4777 AuraApplication* aurApp = i->second;
4778 ASSERT(aurApp);
4779 ASSERT(!aurApp->GetRemoveMode());
4780 ASSERT(aurApp->GetTarget() == this);
4781
4782 aurApp->SetRemoveMode(removeMode);
4783 Aura* aura = aurApp->GetBase();
4784 LOG_DEBUG("spells.aura", "Aura {} now is remove mode {}", aura->GetId(), removeMode);
4785
4786 // dead loop is killing the server probably
4787 ASSERT(m_removedAurasCount < 0xFFFFFFFF);
4788
4790
4791 Unit* caster = aura->GetCaster();
4792
4793 // Remove all pointers from lists here to prevent possible pointer invalidation on spellcast/auraapply/auraremove
4794 m_appliedAuras.erase(i);
4795
4796 // xinef: do not insert our application to interruptible list if application target is not the owner (area auras)
4797 // xinef: event if it gets removed, it will be reapplied in a second
4798 if (aura->GetSpellInfo()->AuraInterruptFlags && this == aura->GetOwner())
4799 {
4800 m_interruptableAuras.remove(aurApp);
4802 }
4803
4804 bool auraStateFound = false;
4805 AuraStateType auraState = aura->GetSpellInfo()->GetAuraState();
4806 if (auraState)
4807 {
4808 bool canBreak = false;
4809 // Get mask of all aurastates from remaining auras
4810 for (AuraStateAurasMap::iterator itr = m_auraStateAuras.lower_bound(auraState); itr != m_auraStateAuras.upper_bound(auraState) && !(auraStateFound && canBreak);)
4811 {
4812 if (itr->second == aurApp)
4813 {
4814 m_auraStateAuras.erase(itr);
4815 itr = m_auraStateAuras.lower_bound(auraState);
4816 canBreak = true;
4817 continue;
4818 }
4819 auraStateFound = true;
4820 ++itr;
4821 }
4822 }
4823
4824 aurApp->_Remove();
4825 aura->_UnapplyForTarget(this, caster, aurApp);
4826
4827 // remove effects of the spell - needs to be done after removing aura from lists
4828 for (uint8 itr = 0; itr < MAX_SPELL_EFFECTS; ++itr)
4829 {
4830 if (aurApp->HasEffect(itr))
4831 aurApp->_HandleEffect(itr, false);
4832 }
4833
4834 // all effect mustn't be applied
4835 ASSERT(!aurApp->GetEffectMask());
4836
4837 // Remove totem at next update if totem loses its aura
4838 if (aurApp->GetRemoveMode() == AURA_REMOVE_BY_EXPIRE && IsTotem() && GetGUID() == aura->GetCasterGUID())
4839 {
4840 if (ToTotem()->GetSpell() == aura->GetId() && ToTotem()->GetTotemType() == TOTEM_PASSIVE)
4842 }
4843
4844 // Remove aurastates only if needed and were not found
4845 if (auraState)
4846 {
4847 if (!auraStateFound)
4848 ModifyAuraState(auraState, false);
4849 else
4850 {
4851 // update for casters, some shouldn't 'see' the aura state
4852 uint32 aStateMask = (1 << (auraState - 1));
4853 if ((aStateMask & PER_CASTER_AURA_STATE_MASK) != 0)
4855 }
4856 }
4857
4858 aura->HandleAuraSpecificMods(aurApp, caster, false, false);
4859
4860 // only way correctly remove all auras from list
4861 //if (removedAuras != m_removedAurasCount) new aura may be added
4862 i = m_appliedAuras.begin();
4863
4864 sScriptMgr->OnAuraRemove(this, aurApp, removeMode);
4865
4866 if (this->ToCreature() && this->ToCreature()->IsAIEnabled)
4867 this->ToCreature()->AI()->OnAuraRemove(aurApp, removeMode);
4868}
@ AURA_REMOVE_BY_EXPIRE
Definition SpellAuraDefines.h:395
@ TOTEM_PASSIVE
Definition Totem.h:25
Unit * GetTarget() const
Definition SpellAuras.h:61
void SetRemoveMode(AuraRemoveMode mode)
Definition SpellAuras.h:72
void _Remove()
Definition SpellAuras.cpp:94
bool HasEffect(uint8 effect) const
Definition SpellAuras.h:67
virtual void _UnapplyForTarget(Unit *target, Unit *caster, AuraApplication *auraApp)
Definition SpellAuras.cpp:454
virtual void OnAuraRemove(AuraApplication *, AuraRemoveMode)
Definition CreatureAI.h:232
CreatureAI * AI() const
Definition Creature.h:144
void setDeathState(DeathState s, bool despawn=false) override
A creature can be in 4 different states: Alive, JustDied, Corpse, and JustRespawned....
Definition TemporarySummon.cpp:400
Totem * ToTotem()
Definition Unit.h:724
void UpdateInterruptMask()
Definition Unit.cpp:876
bool IsTotem() const
Definition Unit.h:793

References AuraApplication::_HandleEffect(), AuraApplication::_Remove(), Aura::_UnapplyForTarget(), Creature::AI(), ASSERT, AURA_REMOVE_BY_EXPIRE, SpellInfo::AuraInterruptFlags, Object::ForceValuesUpdateAtIndex(), SpellInfo::GetAuraState(), AuraApplication::GetBase(), Aura::GetCaster(), Aura::GetCasterGUID(), AuraApplication::GetEffectMask(), Object::GetGUID(), Aura::GetId(), Aura::GetOwner(), AuraApplication::GetRemoveMode(), Aura::GetSpellInfo(), AuraApplication::GetTarget(), Aura::HandleAuraSpecificMods(), AuraApplication::HasEffect(), IsAIEnabled, IsTotem(), JustDied, LOG_DEBUG, m_appliedAuras, m_auraStateAuras, m_interruptableAuras, m_removedAurasCount, MAX_SPELL_EFFECTS, ModifyAuraState(), CreatureAI::OnAuraRemove(), PER_CASTER_AURA_STATE_MASK, Minion::setDeathState(), AuraApplication::SetRemoveMode(), sScriptMgr, Object::ToCreature(), TOTEM_PASSIVE, ToTotem(), UNIT_FIELD_AURASTATE, and UpdateInterruptMask().

Referenced by Aura::_Remove(), _UnapplyAura(), RemoveAllAuras(), RemoveAllAurasExceptType(), RemoveAllAurasOnDeath(), RemoveAllAurasRequiringDeadTarget(), RemoveAura(), and RemoveEvadeAuras().

◆ _UnregisterDynObject()

void Unit::_UnregisterDynObject ( DynamicObject dynObj)
6457{
6458 m_dynObj.remove(dynObj);
6459}

References m_dynObj.

Referenced by DynamicObject::UnbindFromCaster().

◆ _UpdateAutoRepeatSpell()

void Unit::_UpdateAutoRepeatSpell ( )
protected
4020{
4021 SpellInfo const* spellProto = nullptr;
4023 {
4025 }
4026
4027 if (!spellProto)
4028 {
4029 return;
4030 }
4031
4032 static uint32 const HUNTER_AUTOSHOOT = 75;
4033
4034 // Check "realtime" interrupts
4035 if ((IsPlayer() && ToPlayer()->isMoving() && spellProto->Id != HUNTER_AUTOSHOOT) || IsNonMeleeSpellCast(false, false, true, spellProto->Id == HUNTER_AUTOSHOOT))
4036 {
4037 // cancel wand shoot
4038 if (spellProto->Id != HUNTER_AUTOSHOOT)
4040 m_AutoRepeatFirstCast = true;
4041 return;
4042 }
4043
4044 // Apply delay (Hunter's autoshoot not affected)
4045 if (m_AutoRepeatFirstCast && getAttackTimer(RANGED_ATTACK) < 500 && spellProto->Id != HUNTER_AUTOSHOOT)
4046 {
4048 }
4049
4050 m_AutoRepeatFirstCast = false;
4051
4052 // Check for ranged attack timer
4054 {
4056 if (result != SPELL_CAST_OK)
4057 {
4058 if (spellProto->Id != HUNTER_AUTOSHOOT)
4059 {
4061 }
4062
4063 return;
4064 }
4065
4066 // We want to shoot
4067 Spell* spell = new Spell(this, spellProto, TRIGGERED_FULL_MASK);
4068 spell->prepare(&(m_currentSpells[CURRENT_AUTOREPEAT_SPELL]->m_targets));
4069
4070 // Reset attack
4072
4073 // Blizzlike: Reset melee swing timers when performing ranged attack
4076 }
4077}
SpellCastResult
Definition SharedDefines.h:959
@ SPELL_CAST_OK
Definition SharedDefines.h:1149
@ TRIGGERED_FULL_MASK
Will return SPELL_FAILED_DONT_REPORT in CheckCast functions.
Definition SpellDefines.h:150
@ CURRENT_AUTOREPEAT_SPELL
Definition Unit.h:552
Definition Spell.h:295
SpellCastResult prepare(SpellCastTargets const *targets, AuraEffect const *triggeredByAura=nullptr)
Definition Spell.cpp:3400
SpellCastResult CheckCast(bool strict)
Definition Spell.cpp:5594
SpellInfo const *const m_spellInfo
Definition Spell.h:531
void InterruptSpell(CurrentSpellTypes spellType, bool withDelayed=true, bool withInstant=true, bool bySelf=false)
Definition Unit.cpp:4200
bool IsNonMeleeSpellCast(bool withDelayed, bool skipChanneled=false, bool skipAutorepeat=false, bool isAutoshoot=false, bool skipInstant=true) const
Definition Unit.cpp:4242
void setAttackTimer(WeaponAttackType type, int32 time)
Definition Unit.h:879
bool isMoving() const
Definition Unit.h:1692
int32 getAttackTimer(WeaponAttackType type) const
Definition Unit.h:881
bool isAttackReady(WeaponAttackType type=BASE_ATTACK) const
Definition Unit.h:882
void resetAttackTimer(WeaponAttackType type=BASE_ATTACK)
Definition Unit.cpp:751

References BASE_ATTACK, Spell::CheckCast(), CURRENT_AUTOREPEAT_SPELL, getAttackTimer(), SpellInfo::Id, InterruptSpell(), isAttackReady(), isMoving(), IsNonMeleeSpellCast(), Object::IsPlayer(), m_AutoRepeatFirstCast, m_currentSpells, Spell::m_spellInfo, OFF_ATTACK, Spell::prepare(), RANGED_ATTACK, resetAttackTimer(), setAttackTimer(), SPELL_CAST_OK, Object::ToPlayer(), and TRIGGERED_FULL_MASK.

Referenced by _UpdateSpells().

◆ _UpdateSpells()

void Unit::_UpdateSpells ( uint32  time)
protected
3962{
3965
3966 // remove finished spells from current pointers
3967 for (uint32 i = 0; i < CURRENT_MAX_SPELL; ++i)
3968 {
3969 if (m_currentSpells[i] && m_currentSpells[i]->getState() == SPELL_STATE_FINISHED)
3970 {
3972 m_currentSpells[i] = nullptr; // remove pointer
3973 }
3974 }
3975
3976 // m_auraUpdateIterator can be updated in indirect called code at aura remove to skip next planned to update but removed auras
3978 {
3979 Aura* i_aura = m_auraUpdateIterator->second;
3980 ++m_auraUpdateIterator; // need shift to next for allow update if need into aura update
3981 i_aura->UpdateOwner(time, this);
3982 }
3983
3984 // remove expired auras - do that after updates(used in scripts?)
3985 for (AuraMap::iterator i = m_ownedAuras.begin(); i != m_ownedAuras.end();)
3986 {
3987 if (i->second->IsExpired())
3989 else if (i->second->GetSpellInfo()->IsChanneled() && i->second->GetCasterGUID() != GetGUID() && !ObjectAccessor::GetWorldObject(*this, i->second->GetCasterGUID()))
3990 RemoveOwnedAura(i, AURA_REMOVE_BY_CANCEL); // remove channeled auras when caster is not on the same map
3991 else
3992 ++i;
3993 }
3994
3995 for (VisibleAuraMap::iterator itr = m_visibleAuras.begin(); itr != m_visibleAuras.end(); ++itr)
3996 if (itr->second->IsNeedClientUpdate())
3997 itr->second->ClientUpdate();
3998
4000
4001 if (!m_gameObj.empty())
4002 {
4003 for (GameObjectList::iterator itr = m_gameObj.begin(); itr != m_gameObj.end();)
4004 {
4005 if (GameObject* go = ObjectAccessor::GetGameObject(*this, *itr))
4006 if (!go->isSpawned())
4007 {
4008 go->SetOwnerGUID(ObjectGuid::Empty);
4009 go->SetRespawnTime(0);
4010 go->Delete();
4011 m_gameObj.erase(itr++);
4012 continue;
4013 }
4014 ++itr;
4015 }
4016 }
4017}
@ AURA_REMOVE_BY_CANCEL
Definition SpellAuraDefines.h:393
@ SPELL_STATE_FINISHED
Definition Spell.h:237
void UpdateOwner(uint32 diff, WorldObject *owner)
Definition SpellAuras.cpp:698
Definition GameObject.h:120
void RemoveOwnedAura(AuraMap::iterator &i, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
Definition Unit.cpp:4923
void _UpdateAutoRepeatSpell()
Definition Unit.cpp:4019
VisibleAuraMap m_visibleAuras
Definition Unit.h:2168
GameObject * GetGameObject(WorldObject const &u, ObjectGuid const &guid)
Definition ObjectAccessor.cpp:184
WorldObject * GetWorldObject(WorldObject const &, ObjectGuid const &guid)
Definition ObjectAccessor.cpp:115

References _DeleteRemovedAuras(), _UpdateAutoRepeatSpell(), AURA_REMOVE_BY_CANCEL, AURA_REMOVE_BY_EXPIRE, CURRENT_AUTOREPEAT_SPELL, CURRENT_MAX_SPELL, ObjectGuid::Empty, ObjectAccessor::GetGameObject(), Object::GetGUID(), ObjectAccessor::GetWorldObject(), m_auraUpdateIterator, m_currentSpells, m_gameObj, m_ownedAuras, m_visibleAuras, RemoveOwnedAura(), Spell::SetReferencedFromCurrent(), SPELL_STATE_FINISHED, and Aura::UpdateOwner().

Referenced by Update().

◆ AddAura() [1/2]

Aura * Unit::AddAura ( SpellInfo const *  spellInfo,
uint8  effMask,
Unit target 
)
15245{
15246 if (!spellInfo)
15247 return nullptr;
15248
15249 if (target->IsImmunedToSpell(spellInfo))
15250 return nullptr;
15251
15252 for (uint32 i = 0; i < MAX_SPELL_EFFECTS; ++i)
15253 {
15254 if (!(effMask & (1 << i)))
15255 continue;
15256 if (target->IsImmunedToSpellEffect(spellInfo, i))
15257 effMask &= ~(1 << i);
15258 }
15259
15260 if (Aura* aura = Aura::TryRefreshStackOrCreate(spellInfo, effMask, target, this))
15261 {
15262 aura->ApplyForTargets();
15263 return aura;
15264 }
15265 return nullptr;
15266}
static Aura * TryRefreshStackOrCreate(SpellInfo const *spellproto, uint8 tryEffMask, WorldObject *owner, Unit *caster, int32 *baseAmount=nullptr, Item *castItem=nullptr, ObjectGuid casterGUID=ObjectGuid::Empty, bool *refresh=nullptr, bool periodicReset=false)
Definition SpellAuras.cpp:265
virtual bool IsImmunedToSpellEffect(SpellInfo const *spellInfo, uint32 index) const
Definition Unit.cpp:9947
virtual bool IsImmunedToSpell(SpellInfo const *spellInfo, Spell const *spell=nullptr)
Definition Unit.cpp:9857

References Aura::ApplyForTargets(), IsImmunedToSpell(), IsImmunedToSpellEffect(), MAX_SPELL_EFFECTS, and Aura::TryRefreshStackOrCreate().

◆ AddAura() [2/2]

Aura * Unit::AddAura ( uint32  spellId,
Unit target 
)
15230{
15231 if (!target)
15232 return nullptr;
15233
15234 SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId);
15235 if (!spellInfo)
15236 return nullptr;
15237
15238 if (!target->IsAlive() && !spellInfo->HasAttribute(SPELL_ATTR0_PASSIVE) && !spellInfo->HasAttribute(SPELL_ATTR2_ALLOW_DEAD_TARGET))
15239 return nullptr;
15240
15241 return AddAura(spellInfo, MAX_EFFECT_MASK, target);
15242}
#define MAX_EFFECT_MASK
Definition DBCStructure.h:1638
@ SPELL_ATTR2_ALLOW_DEAD_TARGET
Definition SharedDefines.h:467
@ SPELL_ATTR0_PASSIVE
Definition SharedDefines.h:399
#define sSpellMgr
Definition SpellMgr.h:814
bool HasAttribute(SpellAttr0 attribute) const
Definition SpellInfo.h:415
Aura * AddAura(uint32 spellId, Unit *target)
Definition Unit.cpp:15229

References AddAura(), SpellInfo::HasAttribute(), IsAlive(), MAX_EFFECT_MASK, SPELL_ATTR0_PASSIVE, SPELL_ATTR2_ALLOW_DEAD_TARGET, and sSpellMgr.

Referenced by boss_flame_leviathan::ActivateTowers(), AddAura(), boss_grand_champion::boss_grand_championAI::AddCreatureAddonAuras(), Pet::AddToWorld(), Player::ApplyItemDependentAuras(), npc_ritual_channeler::npc_ritual_channelerAI::AttackStart(), npc_pet_dk_ebon_gargoyle::AttackStart(), boss_anzu::boss_anzu(), boss_the_lich_king::boss_the_lich_kingAI::boss_the_lich_kingAI(), boss_twilight_halion::boss_twilight_halionAI::boss_twilight_halionAI(), npc_auriaya_feral_defender::DoAction(), UnitAI::DoAddAuraToAllHostilePlayers(), Spell::DoTriggersOnSpellHit(), npc_anubisath_sentinel::aqsentinelAI::GainSentinelAbility(), AuraEffect::HandleAuraDummy(), Aura::HandleAuraSpecificMods(), deserter_commandscript::HandleDeserterAdd(), gm_commandscript::HandleGMVisibleCommand(), spell_mirkblood_blood_mirror_target_picker::HandleHit(), spell_oculus_rider_aura::HandleOnEffectApply(), spell_transitus_shield_beam_aura::HandleOnEffectApply(), npc_pet_dk_dancing_rune_weapon::InitializeAI(), npc_pet_mage_mirror_image::InitializeAI(), npc_pallid_horror::InitializeAI(), Guardian::InitStatsForLevel(), boss_gahzranka::JustEngagedWith(), boss_freya::JustEngagedWith(), boss_yoggsaron_keeper::JustEngagedWith(), npc_dalaran_warrior::npc_dalaran_warriorAI::JustEngagedWith(), boss_shirrak_the_dead_watcher::JustEngagedWith(), boss_kelidan_the_breaker::JustEngagedWith(), boss_prince_keleseth_icc::boss_prince_kelesethAI::JustEngagedWith(), boss_prince_taldaram_icc::boss_prince_taldaramAI::JustEngagedWith(), boss_prince_valanar_icc::boss_prince_valanarAI::JustEngagedWith(), boss_hadronox::JustSummoned(), npc_thrall_bfu::npc_thrall_bfuAI::JustSummoned(), Creature::LoadCreaturesAddon(), npc_brew_bubble::MoveInLineOfSight(), npc_pet_gen_plump_turkey::MovementInform(), instance_halls_of_reflection::instance_halls_of_reflection_InstanceMapScript::OnCreatureCreate(), instance_icecrown_citadel::instance_icecrown_citadel_InstanceMapScript::OnCreatureCreate(), spell_yogg_saron_empowered_aura::OnPeriodic(), instance_stratholme::instance_stratholme_InstanceMapScript::OnPlayerEnter(), BattlefieldWG::OnPlayerEnterZone(), AreaTrigger_at_area_52_entrance::OnTrigger(), Player::ProcessDelayedOperations(), npc_lake_frog::npc_lake_frogAI::ReceiveEmote(), npc_corrupted_totem::Reset(), npc_troll_volunteer::npc_troll_volunteerAI::Reset(), npc_vengeful_shade::npc_vengeful_shadeAI::Reset(), boss_the_lich_king::boss_the_lich_kingAI::Reset(), boss_magus_telestra::Reset(), npc_auriaya_feral_defender::Reset(), npc_hodirs_fury::Reset(), npc_mimirons_inferno::Reset(), boss_yoggsaron_immortal_guardian::Reset(), boss_archavon::boss_archavonAI::Reset(), boss_emalon::boss_emalonAI::Reset(), boss_koralon::boss_koralonAI::Reset(), boss_toravon::boss_toravonAI::Reset(), npc_dalaran_mage::npc_dalaran_mageAI::Reset(), npc_pet_gen_argent_pony_bridle::Reset(), Player::SendInitialPacketsAfterAddToMap(), npc_corrupted_totem::SetAura(), SetAuraStack(), Player::SetGMVisible(), Player::SetIsSpectator(), npc_artorius::npc_artoriusAI::SpellHit(), npc_simone::npc_simoneAI::SpellHit(), npc_nelson::npc_nelsonAI::SpellHit(), npc_overlord_drakuru_betrayal::SpellHitTarget(), boss_netherspite::SwitchToPortalPhase(), spell_pal_immunities::TriggerDebuffs(), boss_gyth::boss_gythAI::UpdateAI(), boss_pyroguard_emberseer::boss_pyroguard_emberseerAI::UpdateAI(), npc_tiger_matriarch_credit::npc_tiger_matriarch_creditAI::UpdateAI(), npc_tiger_matriarch::npc_tiger_matriarchAI::UpdateAI(), boss_sister_svalna::boss_sister_svalnaAI::UpdateAI(), npc_boss_gothik_minion::npc_boss_gothik_minionAI::UpdateAI(), boss_freya_elder_brightleaf::UpdateAI(), npc_pet_gen_toxic_wasteling::UpdateAI(), boss_netherspite::UpdatePortals(), and npc_emily::npc_emilyAI::WaypointReached().

◆ AddComboPointHolder()

void Unit::AddComboPointHolder ( Unit unit)
inline
1012{ m_ComboPointHolders.insert(unit); }
std::unordered_set< Unit * > m_ComboPointHolders
Definition Unit.h:2228

References m_ComboPointHolders.

Referenced by AddComboPoints().

◆ AddComboPoints() [1/2]

void Unit::AddComboPoints ( int8  count)
inline
1009{ AddComboPoints(nullptr, count); }
void AddComboPoints(Unit *target, int8 count)
Definition Unit.cpp:13340

References AddComboPoints().

Referenced by AddComboPoints().

◆ AddComboPoints() [2/2]

void Unit::AddComboPoints ( Unit target,
int8  count 
)
13341{
13342 if (!count)
13343 {
13344 return;
13345 }
13346
13347 if (target && target != m_comboTarget)
13348 {
13349 if (m_comboTarget)
13350 {
13352 }
13353
13354 m_comboTarget = target;
13355 m_comboPoints = count;
13356 target->AddComboPointHolder(this);
13357 }
13358 else
13359 {
13360 m_comboPoints = std::max<int8>(std::min<int8>(m_comboPoints + count, 5), 0);
13361 }
13362
13364}
void SendComboPoints()
Definition Unit.cpp:13383
void AddComboPointHolder(Unit *unit)
Definition Unit.h:1012
void RemoveComboPointHolder(Unit *unit)
Definition Unit.h:1013

References AddComboPointHolder(), m_comboPoints, m_comboTarget, RemoveComboPointHolder(), and SendComboPoints().

Referenced by Spell::_handle_finish_phase(), AuraEffect::HandleAuraRetainComboPoints(), and ProcSkillsAndReactives().

◆ AddExtraAttacks()

void Unit::AddExtraAttacks ( uint32  count)
2898{
2900 if (!targetGUID)
2901 {
2902 if (ObjectGuid selection = GetTarget())
2903 {
2904 targetGUID = selection; // Spell was cast directly (not triggered by aura)
2905 }
2906 else
2907 return;
2908 }
2909
2910 extraAttacksTargets[targetGUID] += count;
2911}
std::unordered_map< ObjectGuid, uint32 > extraAttacksTargets
Definition Unit.h:2239
ObjectGuid _lastDamagedTargetGuid
Definition Unit.h:2240
ObjectGuid GetTarget() const
Definition Unit.h:855

References _lastDamagedTargetGuid, extraAttacksTargets, and GetTarget().

Referenced by Spell::EffectAddExtraAttacks().

◆ AddExtraUnitMovementFlag()

void Unit::AddExtraUnitMovementFlag ( uint16  f)
inline
772{ m_movementInfo.flags2 |= f; }
MovementInfo m_movementInfo
Definition Object.h:693
uint16 flags2
Definition Object.h:291

References MovementInfo::flags2, and WorldObject::m_movementInfo.

Referenced by Vehicle::InitMovementInfoForBase().

◆ addFollower()

void Unit::addFollower ( FollowerReference pRef)
inline
void insertFirst(LinkedListElement *pElem)
Definition LinkedList.h:105
FollowerRefMgr m_FollowingRefMgr
Definition Unit.h:2224

References LinkedListHead::insertFirst(), and m_FollowingRefMgr.

Referenced by FollowerReference::targetObjectBuildLink().

◆ AddGameObject()

void Unit::AddGameObject ( GameObject gameObj)
6513{
6514 if (!gameObj || gameObj->GetOwnerGUID())
6515 return;
6516
6517 m_gameObj.push_back(gameObj->GetGUID());
6518 gameObj->SetOwnerGUID(GetGUID());
6519
6520 if (IsPlayer() && gameObj->GetSpellId())
6521 {
6522 SpellInfo const* createBySpell = sSpellMgr->GetSpellInfo(gameObj->GetSpellId());
6523 // Need disable spell use for owner
6524 if (createBySpell && createBySpell->IsCooldownStartedOnEvent())
6525 // note: item based cooldowns and cooldown spell mods with charges ignored (unknown existing cases)
6526 ToPlayer()->AddSpellAndCategoryCooldowns(createBySpell, 0, nullptr, true);
6527 }
6528}
uint32 GetSpellId() const
Definition GameObject.h:181
void SetOwnerGUID(ObjectGuid owner)
Definition GameObject.h:163
ObjectGuid GetOwnerGUID() const
Definition GameObject.h:173
void AddSpellAndCategoryCooldowns(SpellInfo const *spellInfo, uint32 itemId, Spell *spell=nullptr, bool infinityCooldown=false)
Definition Player.cpp:10850
bool IsCooldownStartedOnEvent() const
Definition SpellInfo.cpp:1212

References Player::AddSpellAndCategoryCooldowns(), Object::GetGUID(), Object::GetGUID(), GameObject::GetOwnerGUID(), GameObject::GetSpellId(), SpellInfo::IsCooldownStartedOnEvent(), Object::IsPlayer(), m_gameObj, GameObject::SetOwnerGUID(), sSpellMgr, and Object::ToPlayer().

Referenced by Spell::EffectDuel(), Spell::EffectSummonObject(), Spell::EffectTransmitted(), npc_midsummer_bonfire::Ignite(), and WorldObject::SummonGameObject().

◆ addHatedBy()

void Unit::addHatedBy ( HostileReference pHostileReference)
inline

◆ AddInterruptMask()

void Unit::AddInterruptMask ( uint32  mask)
inline
1593{ m_interruptMask |= mask; }

References m_interruptMask.

Referenced by _CreateAuraApplication(), and Spell::handle_immediate().

◆ AddPetAura()

void Unit::AddPetAura ( PetAura const *  petSpell)
13812{
13813 if (!IsPlayer())
13814 return;
13815
13816 m_petAuras.insert(petSpell);
13817 if (Pet* pet = ToPlayer()->GetPet())
13818 pet->CastPetAura(petSpell);
13819 else if (Unit* charm = GetCharm())
13820 charm->CastPetAura(petSpell);
13821}
Definition Pet.h:41
Unit * GetCharm() const
Definition Unit.cpp:7660
PetAuraSet m_petAuras
Definition Unit.h:2081
Pet * GetPet(WorldObject const &, ObjectGuid const &guid)
Definition ObjectAccessor.cpp:215

References GetCharm(), Object::IsPlayer(), m_petAuras, and Object::ToPlayer().

Referenced by Spell::EffectDummy(), and AuraEffect::HandleAuraDummy().

◆ AddPlayerToVision()

void Unit::AddPlayerToVision ( Player player)
8165{
8166 if (m_sharedVision.empty())
8167 setActive(true);
8168
8169 m_sharedVision.push_back(player);
8170 player->m_isInSharedVisionOf.insert(this);
8171}
void setActive(bool isActiveObject)
Definition Object.cpp:1058

References Player::m_isInSharedVisionOf, m_sharedVision, and WorldObject::setActive().

◆ AddPointedBy()

void Unit::AddPointedBy ( SafeUnitPointer sup)
inline
2004{ SafeUnitPointerSet.insert(sup); }
std::set< SafeUnitPointer * > SafeUnitPointerSet
Definition Unit.h:2090

References SafeUnitPointerSet.

Referenced by SafeUnitPointer::SetPointedTo().

◆ AddSpellCooldown()

virtual void Unit::AddSpellCooldown ( uint32  ,
uint32  ,
uint32  ,
bool  needSendToClient = false,
bool  forceSendToSpectator = false 
)
inlinevirtual

Reimplemented in Player, and Creature.

1327 {
1328 // workaround for unused parameters
1329 (void)needSendToClient;
1330 (void)forceSendToSpectator;
1331 }

Referenced by spell_yogg_saron_protective_gaze_aura::Absorb(), Spell::DoSpellHitOnUnit(), spell_sha_earth_shield::HandleProc(), spell_warl_demonic_pact_aura::HandleProc(), spell_warr_sweeping_strikes::HandleProc(), and spell_dk_wandering_plague_aura::HandleProc().

◆ AddThreat()

void Unit::AddThreat ( Unit victim,
float  fThreat,
SpellSchoolMask  schoolMask = SPELL_SCHOOL_MASK_NORMAL,
SpellInfo const *  threatSpell = nullptr 
)
11534{
11535 // Only mobs can manage threat lists
11537 {
11538 m_ThreatMgr.AddThreat(victim, fThreat, schoolMask, threatSpell);
11539 }
11540}
@ UNIT_STATE_EVADE
Definition UnitDefines.h:191
void AddThreat(Unit *victim, float threat, SpellSchoolMask schoolMask=SPELL_SCHOOL_MASK_NORMAL, SpellInfo const *threatSpell=nullptr)
Definition ThreatMgr.cpp:504
bool HasUnitState(const uint32 f) const
Definition Unit.h:730
bool CanHaveThreatList(bool skipAliveCheck=false) const
Definition Unit.cpp:11494

References ThreatMgr::AddThreat(), CanHaveThreatList(), HasUnitState(), m_ThreatMgr, and UNIT_STATE_EVADE.

Referenced by Attack(), npc_ritual_channeler::npc_ritual_channelerAI::AttackStart(), boss_shade_of_aran::AttackStart(), boss_alythess::AttackStart(), npc_vengeful_shade::npc_vengeful_shadeAI::AttackStart(), boss_kelthuzad_minion::boss_kelthuzad_minionAI::AttackStart(), npc_capernian::AttackStart(), npc_zuljin_vortex::ChangeToNewPlayer(), npc_dirt_mound::ChaseNewTarget(), boss_buru::ChaseNewVictim(), npc_dark_nucleus::npc_dark_nucleusAI::DamageTaken(), boss_prince_keleseth_icc::boss_prince_kelesethAI::DamageTaken(), boss_prince_taldaram_icc::boss_prince_taldaramAI::DamageTaken(), boss_prince_valanar_icc::boss_prince_valanarAI::DamageTaken(), boss_yoggsaron_crusher_tentacle::DamageTaken(), boss_thorim::DamageTaken(), DealDamage(), npc_ball_of_flame::npc_ball_of_flameAI::DoAction(), npc_living_constellation::DoAction(), CreatureAI::DoZoneInCombat(), Spell::EffectThreat(), boss_sapphiron::boss_sapphironAI::EnterCombatSelfFunction(), npc_raging_flames::FixateRandomTarget(), npc_torloth_the_magnificent::npc_torloth_the_magnificentAI::HandleAnimation(), AuraEffect::HandleAuraDummy(), spell_morogrim_tidewalker_water_globule_new_target::HandleDummy(), spell_teron_gorefiend_shadowy_construct::HandleEffectApply(), AuraEffect::HandlePeriodicManaLeechAuraTick(), spell_frostwarden_handler_focus_fire::HandleScript(), spell_the_lich_king_vile_spirit_move_target_search::HandleScript(), spell_pursue::HandleScript(), Spell::HandleThreatSpells(), npc_supremus_punch_invisible_stalker::IsSummonedBy(), npc_tiger_matriarch::npc_tiger_matriarchAI::IsSummonedBy(), npc_little_ooze::npc_little_oozeAI::IsSummonedBy(), npc_malchezaar_axe::JustEngagedWith(), boss_kagani_nightstrike::JustEngagedWith(), boss_buru::JustEngagedWith(), npc_daphne_stilwell::npc_daphne_stilwellAI::JustSummoned(), npc_hor_lich_king::npc_hor_lich_kingAI::JustSummoned(), boss_curator::JustSummoned(), boss_sacrolash::JustSummoned(), boss_devourer_of_souls::boss_devourer_of_soulsAI::JustSummoned(), npc_akama_illidan::JustSummoned(), boss_nethermancer_sepethrea::JustSummoned(), npc_thrall_bfu::npc_thrall_bfuAI::JustSummoned(), npc_pet_hunter_snake_trap::MoveInLineOfSight(), boss_shade_of_akama::MovementInform(), npc_gunship_mage::npc_gunship_mageAI::MovementInform(), boss_leotheras_the_blind::MoveToTargetIfOutOfRange(), npc_pet_mage_mirror_image::MySelectNextTarget(), SmartScript::ProcessAction(), RemoveCharmedBy(), npc_dark_fiend::Reset(), npc_swarm_scarab::npc_swarm_scarabAI::Reset(), boss_skarvald_the_constructor::Reset(), boss_dalronn_the_controller::Reset(), npc_pet_hunter_snake_trap::Reset(), boss_warbringer_omrogg::ScheduleBurningPhase(), boss_romulo::ScheduleCombat(), npc_thaladred::ScheduleEvents(), boss_warbringer_omrogg::ScheduleNonBurningPhase(), boss_supremus::SchedulePhase(), boss_thorim_arena_npcs::SelectT(), npc_varian_wrynn::npc_varian_wrynnAI::SpawnWave(), npc_thrall_bfu::npc_thrall_bfuAI::SpawnWave(), boss_eck::SpellHitTarget(), boss_darkmaster_gandling::boss_darkmaster_gandlingAI::SpellHitTarget(), spell_putricide_ooze_channel::StartAttack(), npc_vaelastrasz_the_red::npc_vaelastrasz_the_redAI::UpdateAI(), npc_varian_wrynn::npc_varian_wrynnAI::UpdateAI(), npc_thrall_bfu::npc_thrall_bfuAI::UpdateAI(), boss_sartura::UpdateAI(), npc_sartura_royal_guard::UpdateAI(), npc_toc5_grand_champion_minion::npc_toc5_grand_champion_minionAI::UpdateAI(), boss_grand_champion::boss_grand_championAI::UpdateAI(), npc_fel_infernal::npc_fel_infernalAI::UpdateAI(), npc_shadowy_mercenary::npc_shadowy_mercenaryAI::UpdateAI(), npc_high_overlord_saurfang_igb::npc_high_overlord_saurfang_igbAI::UpdateAI(), npc_muradin_bronzebeard_igb::npc_muradin_bronzebeard_igbAI::UpdateAI(), npc_gunship_boarding_addAI::UpdateAI(), npc_gunship_gunner::npc_gunship_gunnerAI::UpdateAI(), npc_little_ooze::npc_little_oozeAI::UpdateAI(), boss_patchwerk::boss_patchwerkAI::UpdateAI(), boss_thaddius_summon::boss_thaddius_summonAI::UpdateAI(), npc_molten_golem::UpdateAI(), boss_skarvald_the_constructor::UpdateAI(), npc_frozen_orb::npc_frozen_orbAI::UpdateAI(), and npc_hourglass_of_eternity::npc_hourglass_of_eternityAI::UpdateAI().

◆ AddToWorld()

void Unit::AddToWorld ( )
overridevirtual

Reimplemented from Object.

12685{
12686 if (!IsInWorld())
12687 {
12689 }
12690}
void AddToWorld() override
Definition Object.cpp:1190

References WorldObject::AddToWorld(), and Object::IsInWorld().

Referenced by Creature::AddToWorld(), Pet::AddToWorld(), and Player::AddToWorld().

◆ AddUnitMovementFlag()

◆ AddUnitState()

void Unit::AddUnitState ( uint32  f)
inline
729{ m_state |= f; }

References m_state.

Referenced by _ExitVehicle(), RandomMovementGenerator< T >::_setRandomLocation(), MotionTransport::AddPassenger(), Attack(), boss_prince_keleseth_icc::boss_prince_kelesethAI::boss_prince_kelesethAI(), boss_prince_taldaram_icc::boss_prince_taldaramAI::boss_prince_taldaramAI(), boss_prince_valanar_icc::boss_prince_valanarAI::boss_prince_valanarAI(), Creature::Create(), MotionTransport::CreateNPCPassenger(), boss_black_knight::boss_black_knightAI::DamageTaken(), boss_thorim::DisableThorim(), boss_nightbane::DoAction(), WaypointMovementGenerator< Creature >::DoInitialize(), RandomMovementGenerator< T >::DoInitialize(), ChaseMovementGenerator< T >::DoInitialize(), ChaseMovementGenerator< T >::DoInitialize(), WaypointMovementGenerator< Creature >::DoReset(), FlightPathMovementGenerator::DoReset(), boss_yoggsaron_sara::EnableSara(), boss_jindo::EnterEvadeMode(), CreatureAI::EnterEvadeMode(), SmartAI::EnterEvadeMode(), npc_pet_hunter_snake_trap::EnterEvadeMode(), Creature::FocusTarget(), boss_blood_queen_lana_thel::boss_blood_queen_lana_thelAI::GoToMinchar(), AuraEffect::HandleAuraModSchoolImmunity(), debug_commandscript::HandleDebugUnitStateCommand(), AuraEffect::HandleFeignDeath(), WorldSession::HandlePetCastSpellOpcode(), RotateMovementGenerator::Initialize(), DistractMovementGenerator::Initialize(), npc_pet_dk_ebon_gargoyle::InitializeAI(), Player::LoadFromDB(), boss_ayamiss::MovementInform(), boss_lady_vashj::MovementInform(), npc_pet_gen_moth::npc_pet_gen_moth(), npc_pet_gen_valkyr_guardian::npc_pet_gen_valkyr_guardian(), npc_pet_gen_wind_rider_cub::npc_pet_gen_wind_rider_cub(), npc_corrupted_totem::Reset(), boss_jedoga_shadowseeker::Reset(), npc_ulduar_mimiron_rocket::Reset(), boss_hungarfen::Reset(), npc_torloth_the_magnificent::npc_torloth_the_magnificentAI::Reset(), SetCharmedBy(), SmartAI::SetCombatMovement(), SetContestedPvP(), SetControlled(), SetCurrentCastedSpell(), Player::setDeathState(), Player::SetIsSpectator(), SetRooted(), boss_urom::boss_uromAI::SpellHit(), WaypointMovementGenerator< Creature >::StartMove(), npc_madrigosa::UpdateAI(), boss_devourer_of_souls::boss_devourer_of_soulsAI::UpdateAI(), boss_krick::boss_krickAI::UpdateAI(), npc_valkyr_shadowguard::npc_valkyr_shadowguardAI::UpdateAI(), and boss_svala::boss_svalaAI::UpdateAI().

◆ AddUnitTypeMask()

void Unit::AddUnitTypeMask ( uint32  mask)
inline
736{ m_unitTypeMask |= mask; }

References m_unitTypeMask.

◆ ApplyAttackTimePercentMod()

void Unit::ApplyAttackTimePercentMod ( WeaponAttackType  att,
float  val,
bool  apply 
)
13562{
13564
13565 float remainingTimePct = std::max((float)m_attackTimer[att], 0.0f) / (GetAttackTime(att) * m_modAttackSpeedPct[att]);
13566 if (val > 0.f)
13567 {
13569 ApplyPercentModFloatVar(amount, val, !apply);
13570 }
13571 else
13572 {
13574 ApplyPercentModFloatVar(amount, -val, apply);
13575 }
13577 m_attackTimer[att] = uint32(GetAttackTime(att) * m_modAttackSpeedPct[att] * remainingTimePct);
13578}
void ApplyPercentModFloatVar(float &var, float val, bool apply)
Definition Unit.cpp:13556
@ UNIT_FIELD_BASEATTACKTIME
Definition UpdateFields.h:120
constexpr std::underlying_type< E >::type AsUnderlyingType(E enumValue)
Definition Util.h:610
float GetFloatValue(uint16 index) const
Definition Object.cpp:306
void SetFloatValue(uint16 index, float value)
Definition Object.cpp:726
uint32 GetAttackTime(WeaponAttackType att) const
Definition Unit.h:908

References ApplyPercentModFloatVar(), AsUnderlyingType(), GetAttackTime(), Object::GetFloatValue(), m_attackTimer, m_modAttackSpeedPct, Object::SetFloatValue(), and UNIT_FIELD_BASEATTACKTIME.

Referenced by Player::ApplyRatingMod(), AuraEffect::HandleAuraModRangedHaste(), AuraEffect::HandleModAttackSpeed(), AuraEffect::HandleModCombatSpeedPct(), AuraEffect::HandleModMeleeRangedSpeedPct(), AuraEffect::HandleModMeleeSpeedPct(), and AuraEffect::HandleRangedAmmoHaste().

◆ ApplyCastTimePercentMod()

void Unit::ApplyCastTimePercentMod ( float  val,
bool  apply 
)
13581{
13582 float amount = GetFloatValue(UNIT_MOD_CAST_SPEED);
13583
13584 if (val > 0.f)
13585 ApplyPercentModFloatVar(amount, val, !apply);
13586 else
13587 ApplyPercentModFloatVar(amount, -val, apply);
13588
13590}
@ UNIT_MOD_CAST_SPEED
Definition UpdateFields.h:137

References ApplyPercentModFloatVar(), Object::GetFloatValue(), Object::SetFloatValue(), and UNIT_MOD_CAST_SPEED.

Referenced by Player::ApplyRatingMod(), AuraEffect::HandleModCastingSpeed(), and AuraEffect::HandleModCombatSpeedPct().

◆ ApplyDiminishingAura()

void Unit::ApplyDiminishingAura ( DiminishingGroup  group,
bool  apply 
)
12007{
12008 // Checking for existing in the table
12009 for (Diminishing::iterator i = m_Diminishing.begin(); i != m_Diminishing.end(); ++i)
12010 {
12011 if (i->DRGroup != group)
12012 continue;
12013
12014 if (apply)
12015 i->stack += 1;
12016 else if (i->stack)
12017 {
12018 i->stack -= 1;
12019 // Remember time after last aura from group removed
12020 if (i->stack == 0)
12021 i->hitTime = GameTime::GetGameTimeMS().count();
12022 }
12023 break;
12024 }
12025}
Diminishing m_Diminishing
Definition Unit.h:2220
Milliseconds GetGameTimeMS()
Definition GameTime.cpp:43

References GameTime::GetGameTimeMS(), and m_Diminishing.

Referenced by UnitAura::_ApplyForTarget(), and UnitAura::_UnapplyForTarget().

◆ ApplyDiminishingToDuration()

float Unit::ApplyDiminishingToDuration ( DiminishingGroup  group,
int32 duration,
Unit caster,
DiminishingLevels  Level,
int32  limitduration 
)
11928{
11929 // xinef: dont apply diminish to self casts
11930 if (duration == -1 || group == DIMINISHING_NONE)
11931 return 1.0f;
11932
11933 // test pet/charm masters instead pets/charmeds
11934 Unit const* targetOwner = GetOwner();
11935 Unit const* casterOwner = caster->GetOwner();
11936
11937 // Duration of crowd control abilities on pvp target is limited by 10 sec. (2.2.0)
11938 if (limitduration > 0 && duration > limitduration)
11939 {
11940 Unit const* target = targetOwner ? targetOwner : this;
11941 Unit const* source = casterOwner ? casterOwner : caster;
11942
11943 if ((target->IsPlayer()
11945 && source->IsPlayer())
11946 duration = limitduration;
11947 }
11948
11949 float mod = 1.0f;
11950
11951 if (group == DIMINISHING_TAUNT)
11952 {
11954 {
11955 DiminishingLevels diminish = Level;
11956 switch (diminish)
11957 {
11959 break;
11961 mod = 0.65f;
11962 break;
11964 mod = 0.4225f;
11965 break;
11967 mod = 0.274625f;
11968 break;
11970 mod = 0.0f;
11971 break;
11972 default:
11973 break;
11974 }
11975 }
11976 }
11977 // Some diminishings applies to mobs too (for example, Stun)
11979 && ((targetOwner ? (targetOwner->IsPlayer()) : (IsPlayer()))
11980 || (IsCreature() && ToCreature()->HasFlagsExtra(CREATURE_FLAG_EXTRA_ALL_DIMINISH))))
11982 {
11983 DiminishingLevels diminish = Level;
11984 switch (diminish)
11985 {
11987 break;
11989 mod = 0.5f;
11990 break;
11992 mod = 0.25f;
11993 break;
11995 mod = 0.0f;
11996 break;
11997 default:
11998 break;
11999 }
12000 }
12001
12002 duration = int32(duration * mod);
12003 return mod;
12004}
@ CREATURE_FLAG_EXTRA_OBEYS_TAUNT_DIMINISHING_RETURNS
Definition CreatureData.h:64
@ CREATURE_FLAG_EXTRA_ALL_DIMINISH
Definition CreatureData.h:65
@ Level
Requires the player to be at least a specific level.
@ DIMINISHING_NONE
Definition SharedDefines.h:3498
@ DIMINISHING_TAUNT
Definition SharedDefines.h:3516
@ DRTYPE_PLAYER
Definition SharedDefines.h:3491
@ DRTYPE_ALL
Definition SharedDefines.h:3492
DiminishingReturnsType GetDiminishingReturnsGroupType(DiminishingGroup group)
Definition SpellMgr.cpp:242
DiminishingLevels
Definition Unit.h:269
@ DIMINISHING_LEVEL_3
Definition Unit.h:272
@ DIMINISHING_LEVEL_1
Definition Unit.h:270
@ DIMINISHING_LEVEL_4
Definition Unit.h:274
@ DIMINISHING_LEVEL_IMMUNE
Definition Unit.h:273
@ DIMINISHING_LEVEL_TAUNT_IMMUNE
Definition Unit.h:275
@ DIMINISHING_LEVEL_2
Definition Unit.h:271
bool HasFlagsExtra(uint32 flag) const
Definition Creature.h:77

References CREATURE_FLAG_EXTRA_ALL_DIMINISH, CREATURE_FLAG_EXTRA_OBEYS_TAUNT_DIMINISHING_RETURNS, DIMINISHING_LEVEL_1, DIMINISHING_LEVEL_2, DIMINISHING_LEVEL_3, DIMINISHING_LEVEL_4, DIMINISHING_LEVEL_IMMUNE, DIMINISHING_LEVEL_TAUNT_IMMUNE, DIMINISHING_NONE, DIMINISHING_TAUNT, DRTYPE_ALL, DRTYPE_PLAYER, GetDiminishingReturnsGroupType(), GetOwner(), Creature::HasFlagsExtra(), Object::IsCreature(), Object::IsPlayer(), Level, and Object::ToCreature().

Referenced by Spell::DoSpellHitOnUnit().

◆ ApplyEffectModifiers()

float Unit::ApplyEffectModifiers ( SpellInfo const *  spellProto,
uint8  effect_index,
float  value 
) const
11710{
11711 if (Player* modOwner = GetSpellModOwner())
11712 {
11713 modOwner->ApplySpellMod(spellProto->Id, SPELLMOD_ALL_EFFECTS, value);
11714 switch (effect_index)
11715 {
11716 case 0:
11717 modOwner->ApplySpellMod(spellProto->Id, SPELLMOD_EFFECT1, value);
11718 break;
11719 case 1:
11720 modOwner->ApplySpellMod(spellProto->Id, SPELLMOD_EFFECT2, value);
11721 break;
11722 case 2:
11723 modOwner->ApplySpellMod(spellProto->Id, SPELLMOD_EFFECT3, value);
11724 break;
11725 }
11726 }
11727 return value;
11728}
@ SPELLMOD_EFFECT2
Definition SpellDefines.h:88
@ SPELLMOD_ALL_EFFECTS
Definition SpellDefines.h:84
@ SPELLMOD_EFFECT3
Definition SpellDefines.h:99
@ SPELLMOD_EFFECT1
Definition SpellDefines.h:79
Player * GetSpellModOwner() const
Definition Unit.cpp:13064

References GetSpellModOwner(), SpellInfo::Id, SPELLMOD_ALL_EFFECTS, SPELLMOD_EFFECT1, SPELLMOD_EFFECT2, and SPELLMOD_EFFECT3.

Referenced by spell_mage_ice_barrier_aura::CalculateSpellAmount(), spell_mage_ice_barrier::CalculateSpellAmount(), CalculateSpellAmount(), SpellEffectInfo::CalcValue(), and Spell::EffectSchoolDMG().

◆ ApplyResilience()

void Unit::ApplyResilience ( Unit const *  victim,
float *  crit,
int32 damage,
bool  isCrit,
CombatRating  type 
)
static
15294{
15295 // player mounted on multi-passenger mount is also classified as vehicle
15296 if (victim->IsVehicle() && !victim->IsPlayer())
15297 return;
15298
15299 Unit const* target = nullptr;
15300 if (victim->IsPlayer())
15301 target = victim;
15302 else if (victim->IsCreature())
15303 {
15304 if (Unit* owner = victim->GetOwner())
15305 if (owner->IsPlayer())
15306 target = owner;
15307 }
15308
15309 if (!target)
15310 return;
15311
15312 switch (type)
15313 {
15315 // Crit chance reduction works against nonpets
15316 if (crit)
15317 *crit -= target->GetMeleeCritChanceReduction();
15318 if (damage)
15319 {
15320 if (isCrit)
15321 *damage -= target->GetMeleeCritDamageReduction(*damage);
15322 *damage -= target->GetMeleeDamageReduction(*damage);
15323 }
15324 break;
15326 // Crit chance reduction works against nonpets
15327 if (crit)
15328 *crit -= target->GetRangedCritChanceReduction();
15329 if (damage)
15330 {
15331 if (isCrit)
15332 *damage -= target->GetRangedCritDamageReduction(*damage);
15333 *damage -= target->GetRangedDamageReduction(*damage);
15334 }
15335 break;
15337 // Crit chance reduction works against nonpets
15338 if (crit)
15339 *crit -= target->GetSpellCritChanceReduction();
15340 if (damage)
15341 {
15342 if (isCrit)
15343 *damage -= target->GetSpellCritDamageReduction(*damage);
15344 *damage -= target->GetSpellDamageReduction(*damage);
15345 }
15346 break;
15347 default:
15348 break;
15349 }
15350}
@ CR_CRIT_TAKEN_RANGED
Definition Unit.h:239
@ CR_CRIT_TAKEN_SPELL
Definition Unit.h:240
@ CR_CRIT_TAKEN_MELEE
Definition Unit.h:238
float GetSpellCritChanceReduction() const
Definition Unit.h:1261
float GetRangedCritChanceReduction() const
Definition Unit.h:1260
uint32 GetSpellCritDamageReduction(uint32 damage) const
Definition Unit.h:1265
float GetMeleeCritChanceReduction() const
Definition Unit.h:1259
uint32 GetRangedDamageReduction(uint32 damage) const
Definition Unit.h:1253
uint32 GetRangedCritDamageReduction(uint32 damage) const
Definition Unit.h:1264
uint32 GetMeleeCritDamageReduction(uint32 damage) const
Definition Unit.h:1263
uint32 GetSpellDamageReduction(uint32 damage) const
Definition Unit.h:1254
uint32 GetMeleeDamageReduction(uint32 damage) const
Definition Unit.h:1252

References CR_CRIT_TAKEN_MELEE, CR_CRIT_TAKEN_RANGED, CR_CRIT_TAKEN_SPELL, GetMeleeCritChanceReduction(), GetMeleeCritDamageReduction(), GetMeleeDamageReduction(), GetOwner(), GetRangedCritChanceReduction(), GetRangedCritDamageReduction(), GetRangedDamageReduction(), GetSpellCritChanceReduction(), GetSpellCritDamageReduction(), GetSpellDamageReduction(), Object::IsCreature(), Object::IsPlayer(), and IsVehicle().

Referenced by CalculateMeleeDamage(), CalculateSpellDamageTaken(), GetUnitCriticalChance(), spell_valkyr_touch_aura::HandleEffectPeriodic(), AuraEffect::HandlePeriodicDamageAurasTick(), AuraEffect::HandlePeriodicHealthLeechAuraTick(), and SpellTakenCritChance().

◆ ApplySpellDispelImmunity()

void Unit::ApplySpellDispelImmunity ( SpellInfo const *  spellProto,
DispelType  type,
bool  apply 
)
10341{
10342 ApplySpellImmune(spellProto->Id, IMMUNITY_DISPEL, type, apply);
10343
10344 if (apply && spellProto->HasAttribute(SPELL_ATTR1_IMMUNITY_PURGES_EFFECT))
10345 {
10346 // Create dispel mask by dispel type
10347 uint32 dispelMask = SpellInfo::GetDispelMask(type);
10348 // Dispel all existing auras vs current dispel type
10350 for (AuraApplicationMap::iterator itr = auras.begin(); itr != auras.end();)
10351 {
10352 SpellInfo const* spell = itr->second->GetBase()->GetSpellInfo();
10353 if (spell->GetDispelMask() & dispelMask)
10354 {
10355 // Dispel aura
10356 RemoveAura(itr);
10357 }
10358 else
10359 ++itr;
10360 }
10361 }
10362}
@ SPELL_ATTR1_IMMUNITY_PURGES_EFFECT
Definition SharedDefines.h:445
@ IMMUNITY_DISPEL
Definition SharedDefines.h:1409
uint32 GetDispelMask() const
Definition SpellInfo.cpp:1931
void ApplySpellImmune(uint32 spellId, uint32 op, uint32 type, bool apply, SpellImmuneBlockType blockType=SPELL_BLOCK_TYPE_ALL)
Definition Unit.cpp:10313
void RemoveAura(AuraApplicationMap::iterator &i, AuraRemoveMode mode=AURA_REMOVE_BY_DEFAULT)
Definition Unit.cpp:4994
std::multimap< uint32, AuraApplication * > AuraApplicationMap
Definition Unit.h:667
AuraApplicationMap & GetAppliedAuras()
Definition Unit.h:1372

References ApplySpellImmune(), GetAppliedAuras(), SpellInfo::GetDispelMask(), SpellInfo::HasAttribute(), SpellInfo::Id, IMMUNITY_DISPEL, RemoveAura(), and SPELL_ATTR1_IMMUNITY_PURGES_EFFECT.

Referenced by AuraEffect::HandleAuraModDispelImmunity().

◆ ApplySpellImmune()

void Unit::ApplySpellImmune ( uint32  spellId,
uint32  op,
uint32  type,
bool  apply,
SpellImmuneBlockType  blockType = SPELL_BLOCK_TYPE_ALL 
)
10314{
10315 if (apply)
10316 {
10317 // xinef: immunities with spellId 0 are intended to be applied only once (script purposes mosty)
10318 if (spellId == 0 && std::find_if(m_spellImmune[op].begin(), m_spellImmune[op].end(), spellIdImmunityPredicate(type)) != m_spellImmune[op].end())
10319 return;
10320
10321 SpellImmune immune;
10322 immune.spellId = spellId;
10323 immune.type = type;
10324 immune.blockType = blockType;
10325 m_spellImmune[op].push_back(std::move(immune));
10326 }
10327 else
10328 {
10329 for (SpellImmuneList::iterator itr = m_spellImmune[op].begin(); itr != m_spellImmune[op].end(); ++itr)
10330 {
10331 if (itr->spellId == spellId && itr->type == type)
10332 {
10333 m_spellImmune[op].erase(itr);
10334 break;
10335 }
10336 }
10337 }
10338}
Definition Unit.cpp:10304
Definition SpellDefines.h:174
uint32 blockType
Definition SpellDefines.h:179
uint32 spellId
Definition SpellDefines.h:177
uint32 type
Definition SpellDefines.h:178

References SpellImmune::blockType, m_spellImmune, SpellImmune::spellId, and SpellImmune::type.

Referenced by Vehicle::ApplyAllImmunities(), boss_kelidan_the_breaker::ApplyImmunities(), ApplyMechanicImmune(), ApplySpellDispelImmunity(), boss_anubarak_trial::boss_anubarak_trialAI::boss_anubarak_trialAI(), boss_grand_champion::boss_grand_championAI::boss_grand_championAI(), boss_icehowl::boss_icehowlAI::boss_icehowlAI(), boss_sindragosa::boss_sindragosaAI::boss_sindragosaAI(), boss_twin_valkyrAI::boss_twin_valkyrAI(), boss_void_reaver::boss_void_reaver(), boss_lady_deathwhisper::boss_lady_deathwhisperAI::DamageTaken(), boss_auriaya::ExecuteEvent(), AuraEffect::HandleAuraDummy(), AuraEffect::HandleAuraModDmgImmunity(), AuraEffect::HandleAuraModEffectImmunity(), AuraEffect::HandleAuraModIncreaseFlightSpeed(), AuraEffect::HandleAuraModSchoolImmunity(), AuraEffect::HandleAuraModStateImmunity(), Aura::HandleAuraSpecificMods(), spell_q13007_iron_colossus::HandleDummy(), spell_love_in_air_perfume_immune::HandleEffectApply(), spell_teron_gorefiend_shadowy_construct::HandleEffectApply(), spell_dk_anti_magic_shell_self::HandleEffectApply(), spell_dk_army_of_the_dead_passive::HandleEffectApply(), spell_dk_pet_scaling::HandleEffectApply(), spell_dru_treant_scaling::HandleEffectApply(), spell_pet_hit_expertise_scalling::HandleEffectApply(), spell_pet_intellect_spirit_resilience_scaling::HandleEffectApply(), spell_pet_spellhit_expertise_spellpen_scaling::HandleEffectApply(), spell_mage_pet_scaling::HandleEffectApply(), spell_pri_shadowfiend_scaling::HandleEffectApply(), spell_sha_feral_spirit_scaling::HandleEffectApply(), spell_sha_fire_elemental_scaling::HandleEffectApply(), spell_warl_infernal_scaling::HandleEffectApply(), spell_love_in_air_perfume_immune::HandleEffectRemove(), spell_dk_anti_magic_shell_self::HandleEffectRemove(), AuraEffect::HandleModMechanicImmunity(), AuraEffect::HandleModStateImmunityMask(), spell_illidan_shadow_prison_aura::HandleOnEffectApply(), spell_illidan_shadow_prison_aura::HandleOnEffectRemove(), npc_hyjal_jaina::hyjalJainaAI::hyjalJainaAI(), boss_hydross_the_unstable::JustSummoned(), npc_thrall_bfu::npc_thrall_bfuAI::JustSummoned(), npc_varian_wrynn::npc_varian_wrynnAI::JustSummoned(), Player::LoadFromDB(), Creature::LoadSpellTemplateImmunity(), npc_valkyr_shadowguard::npc_valkyr_shadowguardAI::MovementInform(), npc_frost_sphere::npc_frost_sphereAI::npc_frost_sphereAI(), npc_mageguard_dalaran::npc_mageguard_dalaranAI::npc_mageguard_dalaranAI(), npc_necrotic_shard::npc_necrotic_shard(), npc_pos_freed_slave::npc_pos_freed_slaveAI::npc_pos_freed_slaveAI(), npc_target_dummy::npc_target_dummyAI::npc_target_dummyAI(), npc_tournament_training_dummy::npc_tournament_training_dummyAI::npc_tournament_training_dummyAI(), npc_training_dummy::npc_training_dummyAI::npc_training_dummyAI(), npc_ulduar_arachnopod_destroyer::npc_ulduar_arachnopod_destroyer(), npc_valkyr_shadowguard::npc_valkyr_shadowguardAI::npc_valkyr_shadowguardAI(), spell_yogg_saron_malady_of_the_mind_aura::OnApply(), instance_violet_hold::instance_violet_hold_InstanceMapScript::OnCreatureCreate(), spell_yogg_saron_malady_of_the_mind_aura::OnRemove(), boss_flame_leviathan_seat::PassengerBoarded(), npc_hover_disk::PassengerBoarded(), npc_chesspiece::Reset(), boss_curator::Reset(), boss_shade_of_aran::Reset(), npc_sanguine_spirit::Reset(), boss_felblood_kaelthas::Reset(), npc_varian_wrynn::npc_varian_wrynnAI::Reset(), npc_jaina_proudmoore_bfu::npc_jaina_proudmoore_bfuAI::Reset(), npc_thrall_bfu::npc_thrall_bfuAI::Reset(), npc_lady_sylvanas_windrunner_bfu::npc_lady_sylvanas_windrunner_bfuAI::Reset(), npc_dark_iron_guzzler::Reset(), boss_mal_ganis::boss_mal_ganisAI::Reset(), boss_tharon_ja::boss_tharon_jaAI::Reset(), boss_lady_deathwhisper::boss_lady_deathwhisperAI::Reset(), boss_valithria_dreamwalker::boss_valithria_dreamwalkerAI::Reset(), boss_gluth::boss_gluthAI::Reset(), boss_urom::boss_uromAI::Reset(), boss_varos::boss_varosAI::Reset(), boss_auriaya::Reset(), boss_flame_leviathan::Reset(), boss_supremus::Reset(), boss_kaelthas::Reset(), npc_injured_patient::npc_injured_patientAI::Reset(), boss_supremus::SchedulePhase(), boss_hydross_the_unstable::SetForm(), npc_iron_watcher::npc_iron_watcherAI::UpdateAI(), and Creature::UpdateEntry().

◆ ApplyStatPctModifier()

void Unit::ApplyStatPctModifier ( UnitMods  unitMod,
UnitModifierPctType  modifierType,
float  amount 
)
12115{
12116 if (unitMod >= UNIT_MOD_END || modifierType >= MODIFIER_TYPE_PCT_END)
12117 {
12118 LOG_ERROR("entities.unit", "ERROR in ApplyStatPctModifier(): non-existing UnitMods or wrong UnitModifierType!");
12119 return;
12120 }
12121
12122 if (!pct)
12123 return;
12124
12125 switch (modifierType)
12126 {
12127 case BASE_PCT:
12128 case TOTAL_PCT:
12129 AddPct(m_auraPctModifiersGroup[unitMod][modifierType], pct);
12130 break;
12131 default:
12132 break;
12133 }
12134
12135 UpdateUnitMod(unitMod);
12136}
#define LOG_ERROR(filterType__,...)
Definition Log.h:158
@ MODIFIER_TYPE_PCT_END
Definition Unit.h:137
T AddPct(T &base, U pct)
Definition Util.h:58
void UpdateUnitMod(UnitMods unitMod)
Definition Unit.cpp:12178

References AddPct(), BASE_PCT, LOG_ERROR, m_auraPctModifiersGroup, MODIFIER_TYPE_PCT_END, TOTAL_PCT, UNIT_MOD_END, and UpdateUnitMod().

Referenced by boss_marli::_schedulePhaseSpider(), boss_marli::_schedulePhaseTroll(), AuraEffect::HandleAuraIncreaseBaseHealthPercent(), AuraEffect::HandleAuraModAttackPowerPercent(), AuraEffect::HandleAuraModBaseResistancePCT(), AuraEffect::HandleAuraModIncreaseEnergyPercent(), AuraEffect::HandleAuraModIncreaseHealthPercent(), AuraEffect::HandleAuraModRangedAttackPowerPercent(), AuraEffect::HandleModPercentStat(), spell_astromancer_solarian_transform::OnApply(), spell_astromancer_solarian_transform::OnRemove(), boss_arlokk::boss_arlokkAI::Reset(), boss_marli::Reset(), and boss_arlokk::boss_arlokkAI::UpdateAI().

◆ ApplyTotalThreatModifier()

float Unit::ApplyTotalThreatModifier ( float  fThreat,
SpellSchoolMask  schoolMask = SPELL_SCHOOL_MASK_NORMAL 
)
11522{
11523 if (!HasThreatAura() || fThreat < 0)
11524 return fThreat;
11525
11526 SpellSchools school = GetFirstSchoolInMask(schoolMask);
11527
11528 return fThreat * m_threatModifier[school];
11529}
SpellSchools
Definition SharedDefines.h:293
SpellSchools GetFirstSchoolInMask(SpellSchoolMask mask)
Definition SharedDefines.h:329
bool HasThreatAura() const
Definition Unit.h:1815

References GetFirstSchoolInMask(), HasThreatAura(), and m_threatModifier.

Referenced by ThreatCalcHelper::calcThreat().

◆ Attack()

bool Unit::Attack ( Unit victim,
bool  meleeAttack 
)
Todo:
: Implement aggro range, detection range and assistance range templates
7237{
7238 if (!victim || victim == this)
7239 return false;
7240
7241 // dead units can neither attack nor be attacked
7242 if (!IsAlive() || !victim->IsAlive())
7243 return false;
7244
7245 // pussywizard: check map, world, phase >_> multithreading crash fix
7246 if (!IsInMap(victim) || !InSamePhase(victim))
7247 return false;
7248
7249 // player cannot attack in mount state
7250 if (IsPlayer() && IsMounted())
7251 return false;
7252
7253 // creatures cannot attack while evading
7254 Creature* creature = ToCreature();
7255 if (creature && creature->IsInEvadeMode())
7256 {
7257 return false;
7258 }
7259
7260 // creatures should not try to attack the player during polymorph
7261 if (creature && creature->IsPolymorphed())
7262 {
7263 return false;
7264 }
7265
7266 //if (HasUnitFlag(UNIT_FLAG_PACIFIED)) // pussywizard: why having this flag prevents from entering combat? it should just prevent melee attack
7267 // return false;
7268
7269 // nobody can attack GM in GM-mode
7270 if (victim->IsPlayer())
7271 {
7272 if (victim->ToPlayer()->IsGameMaster())
7273 return false;
7274 }
7275 else
7276 {
7277 if (victim->ToCreature()->IsEvadingAttacks())
7278 return false;
7279 }
7280
7281 // Unit with SPELL_AURA_SPIRIT_OF_REDEMPTION can not attack
7283 return false;
7284
7285 // remove SPELL_AURA_MOD_UNATTACKABLE at attack (in case non-interruptible spells stun aura applied also that not let attack)
7286 if (HasUnattackableAura())
7288
7289 if (m_attacking)
7290 {
7291 if (m_attacking == victim)
7292 {
7293 // switch to melee attack from ranged/magic
7294 if (meleeAttack)
7295 {
7297 {
7299 SendMeleeAttackStart(victim);
7300 return true;
7301 }
7302 }
7304 {
7306 SendMeleeAttackStop(victim);
7307 return true;
7308 }
7309 return false;
7310 }
7311
7312 // switch target
7313 InterruptSpell(CURRENT_MELEE_SPELL, true, true, true);
7314 if (!meleeAttack)
7316 }
7317
7318 if (m_attacking)
7320
7321 m_attacking = victim;
7323
7324 // Set our target
7325 SetTarget(victim->GetGUID());
7326
7327 if (meleeAttack)
7329
7330 Unit* owner = GetCharmerOrOwner();
7331 Creature* ownerCreature = owner ? owner->ToCreature() : nullptr;
7332 Creature* controlledCreatureWithSameVictim = nullptr;
7333 if (creature && !m_Controlled.empty())
7334 {
7335 for (ControlSet::iterator itr = m_Controlled.begin(); itr != m_Controlled.end(); ++itr)
7336 {
7337 if ((*itr)->ToCreature() && (*itr)->GetVictim() == victim)
7338 {
7339 controlledCreatureWithSameVictim = (*itr)->ToCreature();
7340 break;
7341 }
7342 }
7343 }
7344
7345 // Share leash timer with controlled unit
7346 if (controlledCreatureWithSameVictim)
7347 creature->SetLastLeashExtensionTimePtr(controlledCreatureWithSameVictim->GetLastLeashExtensionTimePtr());
7348 // Share leash timer with owner
7349 else if (creature && ownerCreature && ownerCreature->GetVictim() == victim)
7351 // Update leash timer when attacking creatures
7352 else if (victim->IsCreature())
7354
7355 // set position before any AI calls/assistance
7356 //if (IsCreature())
7357 // ToCreature()->SetCombatStartPosition(GetPositionX(), GetPositionY(), GetPositionZ());
7358 if (creature && !(IsControllableGuardian() && IsControlledByPlayer()))
7359 {
7360 // should not let player enter combat by right clicking target - doesn't helps
7361 SetInCombatWith(victim);
7362 if (victim->IsPlayer())
7363 victim->SetInCombatWith(this);
7364
7365 AddThreat(victim, 0.0f);
7366
7368
7371 creature->CallAssistance();
7372
7374
7376 }
7377
7378 // delay offhand weapon attack by 50% of the base attack time
7381
7382 if (meleeAttack)
7383 SendMeleeAttackStart(victim);
7384
7385 return true;
7386}
@ CREATURE_FLAG_EXTRA_DONT_CALL_ASSISTANCE
Definition CreatureData.h:70
@ EMOTE_ONESHOT_NONE
Definition SharedDefines.h:1905
@ AI_REACTION_HOSTILE
Definition SharedDefines.h:3482
@ SPELL_AURA_MOD_UNATTACKABLE
Definition SpellAuraDefines.h:156
@ UNIT_STATE_MELEE_ATTACKING
Definition UnitDefines.h:171
@ CURRENT_MELEE_SPELL
Definition Unit.h:549
@ UNIT_NPC_EMOTESTATE
Definition UpdateFields.h:140
T CalculatePct(T base, U pct)
Definition Util.h:52
@ CONFIG_CREATURE_FAMILY_ASSISTANCE_PERIOD
Definition WorldConfig.h:237
void CallAssistance(Unit *target=nullptr)
Definition Creature.cpp:2385
bool IsEvadingAttacks() const
Definition Creature.h:139
std::shared_ptr< time_t > const & GetLastLeashExtensionTimePtr() const
Definition Creature.cpp:3528
void UpdateLeashExtensionTime()
Definition Creature.cpp:3550
void SetAssistanceTimer(uint32 value)
Definition Creature.h:410
void SetLastLeashExtensionTimePtr(std::shared_ptr< time_t > const &timer)
Definition Creature.cpp:3535
void SendAIReaction(AiReaction reactionType)
Definition Creature.cpp:2373
bool IsInEvadeMode() const
Definition Creature.h:138
bool IsGameMaster() const
Definition Player.h:1174
bool HasOffhandWeaponForAttack() const
Definition Unit.h:979
void ClearUnitState(uint32 f)
Definition Unit.h:731
bool IsPolymorphed() const
Definition Unit.cpp:13243
void AddThreat(Unit *victim, float fThreat, SpellSchoolMask schoolMask=SPELL_SCHOOL_MASK_NORMAL, SpellInfo const *threatSpell=nullptr)
Definition Unit.cpp:11533
void _removeAttacker(Unit *pAttacker)
Definition Unit.h:2212
void _addAttacker(Unit *pAttacker)
Definition Unit.h:2211
void SetInCombatWith(Unit *enemy, uint32 duration=0)
Definition Unit.cpp:10507
bool HasUnattackableAura() const
Definition Unit.h:1817
Unit * GetCharmerOrOwner() const
Definition Unit.h:1275
bool IsMounted() const
Definition Unit.h:1870
Unit * GetVictim() const
Definition Unit.h:897
void SendMeleeAttackStart(Unit *victim, Player *sendTo=nullptr)
Definition Unit.cpp:3191
bool IsControllableGuardian() const
Definition Unit.h:790
void SetUInt32Value(uint16 index, uint32 value)
Definition Unit.cpp:17533
void SendMeleeAttackStop(Unit *victim=nullptr)
Send to the client SMSG_ATTACKSTOP but doesn't clear UNIT_STATE_MELEE_ATTACKING on server side or int...
Definition Unit.cpp:3207
bool IsControlledByPlayer() const
Definition Unit.h:1296
bool HasSpiritOfRedemptionAura() const
Definition Unit.h:1788
virtual void SetTarget(ObjectGuid=ObjectGuid::Empty)=0
bool InSamePhase(WorldObject const *obj) const
Definition Object.h:513
bool IsInMap(WorldObject const *obj) const
Definition Object.cpp:1311
#define sWorld
Definition World.h:316

References _addAttacker(), _removeAttacker(), AddThreat(), AddUnitState(), AI_REACTION_HOSTILE, BASE_ATTACK, CalculatePct(), Creature::CallAssistance(), ClearUnitState(), CONFIG_CREATURE_FAMILY_ASSISTANCE_PERIOD, CREATURE_FLAG_EXTRA_DONT_CALL_ASSISTANCE, CURRENT_MELEE_SPELL, EMOTE_ONESHOT_NONE, getAttackTimer(), GetCharmerOrOwner(), Object::GetFloatValue(), Object::GetGUID(), Creature::GetLastLeashExtensionTimePtr(), GetVictim(), Creature::HasFlagsExtra(), HasOffhandWeaponForAttack(), HasSpiritOfRedemptionAura(), HasUnattackableAura(), HasUnitState(), WorldObject::InSamePhase(), InterruptSpell(), IsAlive(), isAttackReady(), IsControllableGuardian(), IsControlledByPlayer(), Object::IsCreature(), Creature::IsEvadingAttacks(), Player::IsGameMaster(), Creature::IsInEvadeMode(), WorldObject::IsInMap(), IsMounted(), Object::IsPlayer(), IsPolymorphed(), m_attacking, m_Controlled, OFF_ATTACK, RemoveAurasByType(), Creature::SendAIReaction(), SendMeleeAttackStart(), SendMeleeAttackStop(), Creature::SetAssistanceTimer(), setAttackTimer(), SetInCombatWith(), Creature::SetLastLeashExtensionTimePtr(), SetTarget(), SetUInt32Value(), SPELL_AURA_MOD_UNATTACKABLE, sWorld, Object::ToCreature(), Object::ToPlayer(), UNIT_FIELD_BASEATTACKTIME, UNIT_NPC_EMOTESTATE, UNIT_STATE_MELEE_ATTACKING, and Creature::UpdateLeashExtensionTime().

Referenced by UnitAI::AttackStart(), FollowerAI::AttackStart(), PossessedAI::AttackStart(), boss_ragnaros::boss_ragnarosAI::AttackStart(), npc_gunship_mage::npc_gunship_mageAI::AttackStart(), npc_gunship_gunner::npc_gunship_gunnerAI::AttackStart(), boss_priestess_lackey_commonAI::AttackStart(), npc_high_overlord_saurfang_igb::npc_high_overlord_saurfang_igbAI::AttackStart(), npc_muradin_bronzebeard_igb::npc_muradin_bronzebeard_igbAI::AttackStart(), boss_lady_deathwhisper::boss_lady_deathwhisperAI::AttackStart(), boss_malygos::AttackStart(), npc_nexus_lord::AttackStart(), boss_swamplord_muselek::AttackStart(), ArcherAI::AttackStart(), TurretAI::AttackStart(), npc_escortAI::AttackStart(), SmartAI::AttackStart(), boss_shade_of_aran::AttackStart(), boss_alythess::AttackStart(), npc_daphne_stilwell::npc_daphne_stilwellAI::AttackStart(), npc_hyjal_ground_trash::AttackStart(), npc_hyjal_gargoyle::AttackStart(), npc_hyjal_frost_wyrm::AttackStart(), boss_jormungarAI::AttackStart(), boss_four_horsemen::boss_four_horsemenAI::AttackStart(), boss_magus_telestra::AttackStart(), boss_kologarn::AttackStart(), boss_mimiron::AttackStart(), npc_ulduar_aerial_command_unit::AttackStart(), boss_razorscale::AttackStart(), boss_lady_malande::AttackStart(), boss_the_lurker_below::AttackStart(), boss_olm_the_summoner::AttackStart(), boss_kiggler_the_crazed::AttackStart(), boss_krosh_firehand::AttackStart(), boss_nazan::AttackStart(), npc_millhouse_manastorm::npc_millhouse_manastormAI::AttackStart(), boss_high_astromancer_solarian::AttackStart(), npc_capernian::AttackStart(), npc_pet_gen_gnomish_flame_turret::AttackStart(), UnitAI::AttackStartCaster(), ScriptedAI::AttackStartNoMove(), PetAI::DoAttack(), WorldSession::HandleAttackSwingOpcode(), spell_q12096_q12092_dummy::HandleDummy(), WorldSession::HandlePetActionHelper(), boss_kologarn_eyebeam::IsSummonedBy(), npc_pet_dk_ghoul::IsSummonedBy(), boss_halazzi::JustSummoned(), boss_algalon_the_observer::JustSummoned(), boss_fathomlord_karathress::JustSummoned(), boss_fathomguard_tidalvess::JustSummoned(), RemoveCharmedBy(), npc_icc_ice_sphere::npc_icc_ice_sphereAI::SelectNewTarget(), npc_hor_leader_second::npc_hor_leader_secondAI::UpdateAI(), npc_tirion_fordring_tft::npc_tirion_fordringAI::UpdateAI(), boss_stormcaller_brundir::UpdateAI(), Player::UpdateCharmedAI(), and npc_ranger_lilatha::WaypointReached().

◆ AttackerStateUpdate()

void Unit::AttackerStateUpdate ( Unit victim,
WeaponAttackType  attType = BASE_ATTACK,
bool  extra = false,
bool  ignoreCasting = false 
)
2696{
2698 {
2699 return;
2700 }
2701
2702 if (HasUnitState(UNIT_STATE_CANNOT_AUTOATTACK) && !extra && !ignoreCasting)
2703 {
2704 return;
2705 }
2706
2707 if (!victim->IsAlive())
2708 return;
2709
2710 if ((attType == BASE_ATTACK || attType == OFF_ATTACK) && !IsWithinLOSInMap(victim))
2711 return;
2712
2713 // CombatStart puts the target into stand state, so we need to cache sit state here to know if we should crit later
2714 const bool sittingVictim = victim->IsPlayer() && (victim->IsSitState() || victim->getStandState() == UNIT_STAND_STATE_SLEEP);
2715
2716 CombatStart(victim);
2718
2719 if (attType != BASE_ATTACK && attType != OFF_ATTACK)
2720 return; // ignore ranged case
2721
2722 if (!extra && _lastExtraAttackSpell)
2723 {
2725 }
2726
2727 bool meleeAttack = true;
2728
2729 // melee attack spell casted at main hand attack only - no normal melee dmg dealt
2730 if (attType == BASE_ATTACK && m_currentSpells[CURRENT_MELEE_SPELL] && !extra)
2731 {
2732 meleeAttack = false; // The melee attack is replaced by the melee spell
2733
2735 SpellCastResult castResult = meleeSpell->CheckCast(false);
2736 if (castResult != SPELL_CAST_OK)
2737 {
2738 meleeSpell->SendCastResult(castResult);
2739 meleeSpell->SendInterrupted(0);
2740
2741 meleeSpell->finish(false);
2742 meleeSpell->SetExecutedCurrently(false);
2743
2744 if (castResult == SPELL_FAILED_NO_POWER)
2745 {
2746 // Not enough rage, do a regular melee attack instead
2747 meleeAttack = true;
2748 }
2749 }
2750 else
2751 {
2752 meleeSpell->cast(true);
2753 }
2754 }
2755 if (meleeAttack)
2756 {
2757 // attack can be redirected to another target
2758 victim = GetMeleeHitRedirectTarget(victim);
2759 CalcDamageInfo damageInfo;
2760 CalculateMeleeDamage(victim, &damageInfo, attType, sittingVictim);
2761
2762 // Send log damage message to client
2763 for (uint8 i = 0; i < MAX_ITEM_PROTO_DAMAGES; ++i)
2764 {
2765 Unit::DealDamageMods(victim, damageInfo.damages[i].damage, &damageInfo.damages[i].absorb);
2766 }
2767
2768 // Related to sparring system. Allow attack animations even if there are no damages
2769 if (victim->CanSparringWith(damageInfo.attacker))
2770 damageInfo.HitInfo |= HITINFO_FAKE_DAMAGE;
2771
2772 SendAttackStateUpdate(&damageInfo);
2773
2774 _lastDamagedTargetGuid = victim->GetGUID();
2775
2776 DealMeleeDamage(&damageInfo, true);
2777
2778 DamageInfo dmgInfo(damageInfo);
2779 Unit::ProcSkillsAndAuras(damageInfo.attacker, damageInfo.target, damageInfo.procAttacker, damageInfo.procVictim, dmgInfo.GetHitMask(), dmgInfo.GetDamage(),
2780 damageInfo.attackType, nullptr, nullptr, -1, nullptr, &dmgInfo);
2781
2782 if (IsPlayer())
2783 LOG_DEBUG("entities.unit", "AttackerStateUpdate: (Player) {} attacked {} for {} dmg, absorbed {}, blocked {}, resisted {}.",
2784 GetGUID().ToString(), victim->GetGUID().ToString(), dmgInfo.GetDamage(), dmgInfo.GetAbsorb(), dmgInfo.GetBlock(), dmgInfo.GetResist());
2785 else
2786 LOG_DEBUG("entities.unit", "AttackerStateUpdate: (NPC) {} attacked {} for {} dmg, absorbed {}, blocked {}, resisted {}.",
2787 GetGUID().ToString(), victim->GetGUID().ToString(), dmgInfo.GetDamage(), dmgInfo.GetAbsorb(), dmgInfo.GetBlock(), dmgInfo.GetResist());
2788
2789 // Let the pet know we've started attacking someting. Handles melee attacks only
2790 // Spells such as auto-shot and others handled in WorldSession::HandleCastSpellOpcode
2791 if (IsPlayer() && !m_Controlled.empty())
2792 for (Unit::ControlSet::iterator itr = m_Controlled.begin(); itr != m_Controlled.end(); ++itr)
2793 if (Unit* pet = *itr)
2794 if (pet->IsAlive() && pet->IsCreature())
2795 pet->ToCreature()->AI()->OwnerAttacked(victim);
2796 }
2797}
#define MAX_ITEM_PROTO_DAMAGES
Definition ItemTemplate.h:613
@ SPELL_FAILED_NO_POWER
Definition SharedDefines.h:1045
@ AURA_INTERRUPT_FLAG_MELEE_ATTACK
Definition SpellDefines.h:55
@ UNIT_STAND_STATE_SLEEP
Definition UnitDefines.h:35
@ UNIT_STATE_CANNOT_AUTOATTACK
Definition UnitDefines.h:218
@ UNIT_FLAG_PACIFIED
Definition UnitDefines.h:271
@ HITINFO_FAKE_DAMAGE
Definition Unit.h:123
Definition Unit.h:337
std::string ToString() const
Definition ObjectGuid.cpp:47
void cast(bool skipCheck=false)
Definition Spell.cpp:3717
void SetExecutedCurrently(bool yes)
Definition Spell.h:573
void SendInterrupted(uint8 result)
Definition Spell.cpp:5114
static void SendCastResult(Player *caster, SpellInfo const *spellInfo, uint8 castCount, SpellCastResult result, SpellCustomErrors customError=SPELL_CUSTOM_ERROR_NONE)
Definition Spell.cpp:4609
void finish(bool ok=true)
Definition Spell.cpp:4417
void SendAttackStateUpdate(CalcDamageInfo *damageInfo)
Definition Unit.cpp:6834
void CombatStart(Unit *target, bool initialAggro=true)
Definition Unit.cpp:10552
Unit * GetMeleeHitRedirectTarget(Unit *victim, SpellInfo const *spellInfo=nullptr)
Definition Unit.cpp:8052
void CalculateMeleeDamage(Unit *victim, CalcDamageInfo *damageInfo, WeaponAttackType attackType=BASE_ATTACK, const bool sittingVictim=false)
Definition Unit.cpp:1604
uint8 getStandState() const
Definition Unit.h:1764
static void ProcSkillsAndAuras(Unit *actor, Unit *victim, uint32 procAttacker, uint32 procVictim, uint32 procEx, uint32 amount, WeaponAttackType attType=BASE_ATTACK, SpellInfo const *procSpellInfo=nullptr, SpellInfo const *procAura=nullptr, int8 procAuraEffectIndex=-1, Spell const *procSpell=nullptr, DamageInfo *damageInfo=nullptr, HealInfo *healInfo=nullptr, uint32 procPhase=2)
Definition Unit.cpp:6710
void DealMeleeDamage(CalcDamageInfo *damageInfo, bool durabilityLoss)
Definition Unit.cpp:1946
bool CanSparringWith(Unit const *attacker) const
Definition Unit.cpp:4079
static void DealDamageMods(Unit const *victim, uint32 &damage, uint32 *absorb)
Definition Unit.cpp:922
bool IsWithinLOSInMap(WorldObject const *obj, VMAP::ModelIgnoreFlags ignoreFlags=VMAP::ModelIgnoreFlags::Nothing, LineOfSightChecks checks=LINEOFSIGHT_ALL_CHECKS, Optional< float > collisionHeight={ }, Optional< float > combatReach={ }) const
Definition Object.cpp:1373
Definition Unit.h:477
uint32 procAttacker
Definition Unit.h:494
uint32 procVictim
Definition Unit.h:495
uint32 absorb
Definition Unit.h:485
struct CalcDamageInfo::@269 damages[MAX_ITEM_PROTO_DAMAGES]
uint32 damage
Definition Unit.h:484
uint32 HitInfo
Definition Unit.h:490
Unit * attacker
Definition Unit.h:478
Unit * target
Definition Unit.h:479
WeaponAttackType attackType
Definition Unit.h:493
std::string ToString() const
Definition Position.cpp:59

References _lastDamagedTargetGuid, _lastExtraAttackSpell, CalcDamageInfo::absorb, CalcDamageInfo::attacker, CalcDamageInfo::attackType, AURA_INTERRUPT_FLAG_MELEE_ATTACK, BASE_ATTACK, CalculateMeleeDamage(), CanSparringWith(), Spell::cast(), Spell::CheckCast(), CombatStart(), CURRENT_MELEE_SPELL, CalcDamageInfo::damage, CalcDamageInfo::damages, DealDamageMods(), DealMeleeDamage(), Spell::finish(), DamageInfo::GetAbsorb(), DamageInfo::GetBlock(), DamageInfo::GetDamage(), Object::GetGUID(), Object::GetGUID(), DamageInfo::GetHitMask(), GetMeleeHitRedirectTarget(), DamageInfo::GetResist(), getStandState(), HasUnitFlag(), HasUnitState(), CalcDamageInfo::HitInfo, HITINFO_FAKE_DAMAGE, IsAlive(), Object::IsPlayer(), IsSitState(), WorldObject::IsWithinLOSInMap(), LOG_DEBUG, m_Controlled, m_currentSpells, MAX_ITEM_PROTO_DAMAGES, OFF_ATTACK, CalcDamageInfo::procAttacker, ProcSkillsAndAuras(), CalcDamageInfo::procVictim, RemoveAurasWithInterruptFlags(), SendAttackStateUpdate(), Spell::SendCastResult(), Spell::SendInterrupted(), Spell::SetExecutedCurrently(), SPELL_CAST_OK, SPELL_FAILED_NO_POWER, CalcDamageInfo::target, ObjectGuid::ToString(), Position::ToString(), UNIT_FLAG_PACIFIED, UNIT_STAND_STATE_SLEEP, and UNIT_STATE_CANNOT_AUTOATTACK.

Referenced by UnitAI::DoMeleeAttackIfReady(), boss_mandokir::boss_mandokirAI::DoMeleeAttackIfReady(), boss_ambassador_hellmaw::DoMeleeAttackIfReady(), HandleProcExtraAttackFor(), boss_twin_valkyrAI::myDoMeleeAttackIfReady(), boss_dred::boss_dredAI::ScheduleTasks(), npc_daphne_stilwell::npc_daphne_stilwellAI::Update(), Player::Update(), boss_kologarn::UpdateAI(), and boss_the_lurker_below::UpdateAI().

◆ AttackStop()

bool Unit::AttackStop ( )

Force the unit to stop attacking. This will clear UNIT_STATE_MELEE_ATTACKING, Interrupt current spell, AI assistance, and call SendMeleeAttackStop() to the client.

7393{
7394 if (!m_attacking)
7395 return false;
7396
7397 Unit* victim = m_attacking;
7398
7400 m_attacking = nullptr;
7401
7402 // Clear our target
7404
7406
7408
7409 // reset only at real combat stop
7410 if (Creature* creature = ToCreature())
7411 {
7412 creature->SetNoCallAssistance(false);
7413
7414 if (creature->HasSearchedAssistance())
7415 {
7416 creature->SetNoSearchAssistance(false);
7417 }
7418 }
7419
7420 SendMeleeAttackStop(victim);
7421
7422 return true;
7423}

References _removeAttacker(), ClearUnitState(), CURRENT_MELEE_SPELL, ObjectGuid::Empty, InterruptSpell(), m_attacking, SendMeleeAttackStop(), SetTarget(), Object::ToCreature(), and UNIT_STATE_MELEE_ATTACKING.

Referenced by PetAI::_stopAttack(), boss_professor_putricide::boss_professor_putricideAI::ChangePhase(), CombatStop(), boss_jedoga_shadowseeker::DamageTaken(), npc_terenas_menethil::npc_terenas_menethilAI::DamageTaken(), boss_algalon_the_observer::DamageTaken(), boss_freya::DamageTaken(), boss_hodir::DamageTaken(), npc_ulduar_leviathan_mkii::DamageTaken(), npc_ulduar_aerial_command_unit::DamageTaken(), advisor_baseAI::DamageTaken(), npc_molten_golem::DamageTaken(), boss_thekal::DamageTaken(), boss_viscidus::DamageTaken(), npc_death_knight_initiate::npc_death_knight_initiateAI::DamageTaken(), boss_the_lich_king::boss_the_lich_kingAI::DamageTaken(), ChaseMovementGenerator< T >::DispatchSplineToPosition(), npc_icc_ice_sphere::npc_icc_ice_sphereAI::DoAction(), boss_algalon_the_observer::DoAction(), ScriptedAI::DoStopAttack(), Player::DuelComplete(), Spell::EffectSanctuary(), SmartAI::EnterEvadeMode(), npc_crystalline_frayer::EnterSeedPod(), Spell::finish(), WorldSession::HandleAttackStopOpcode(), spell_hun_scatter_shot::HandleDummy(), spell_mc_play_dead_aura::HandleEffectApply(), spell_q11065_wrangle_some_aether_rays_aura::HandleEffectApply(), AuraEffect::HandleFeignDeath(), WorldSession::HandlePetActionHelper(), WorldSession::HandlePetStopAttack(), RotateMovementGenerator::Initialize(), boss_janalai::JustEngagedWith(), PetAI::KilledUnit(), MotionMaster::MoveSeekAssistance(), spell_halion_twilight_phasing_aura::OnApply(), spell_halion_twilight_phasing_aura::OnRemove(), PetSpellFail(), RemoveCharmedBy(), boss_janalai::Reset(), boss_talon_king_ikiss::Reset(), boss_warbringer_omrogg::ScheduleBurningPhase(), boss_felmyst::ScheduleGroundAbilities(), boss_warbringer_omrogg::ScheduleNonBurningPhase(), npc_putricide_oozeAI::SelectNewTarget(), npc_icc_ice_sphere::npc_icc_ice_sphereAI::SelectNewTarget(), SetCharmedBy(), npc_cult_fanatic::npc_cult_fanaticAI::SpellHit(), npc_cult_adherent::npc_cult_adherentAI::SpellHit(), boss_attumen::SpellHit(), boss_noth::boss_nothAI::StartBalconyPhase(), boss_heigan::StartFightPhase(), boss_lord_valthalak::boss_lord_valthalakAI::StartTalking(), StopAttackFaction(), StopAttackingInvalidTarget(), boss_ouro::Submerge(), npc_vaelastrasz_the_red::npc_vaelastrasz_the_redAI::UpdateAI(), boss_ragnaros::boss_ragnarosAI::UpdateAI(), boss_arlokk::boss_arlokkAI::UpdateAI(), boss_onyxia::UpdateAI(), npc_qiraj_war_spawn::npc_qiraj_war_spawnAI::UpdateAI(), boss_hadronox::UpdateAI(), boss_saviana_ragefire::boss_saviana_ragefireAI::UpdateAI(), boss_icehowl::boss_icehowlAI::UpdateAI(), npc_hor_leader_second::npc_hor_leader_secondAI::UpdateAI(), boss_blood_queen_lana_thel::boss_blood_queen_lana_thelAI::UpdateAI(), boss_sindragosa::boss_sindragosaAI::UpdateAI(), npc_rimefang::npc_rimefangAI::UpdateAI(), boss_the_lich_king::boss_the_lich_kingAI::UpdateAI(), npc_terenas_menethil::npc_terenas_menethilAI::UpdateAI(), boss_gothik::boss_gothikAI::UpdateAI(), boss_sapphiron::boss_sapphironAI::UpdateAI(), boss_malygos::UpdateAI(), boss_krystallus::boss_krystallusAI::UpdateAI(), boss_mimiron::UpdateAI(), PossessedAI::UpdateAI(), Player::UpdateFFAPvPFlag(), and Player::UpdateFFAPvPState().

◆ BuildAuraStateUpdateForTarget()

uint32 Unit::BuildAuraStateUpdateForTarget ( Unit target) const
7526{
7528 for (AuraStateAurasMap::const_iterator itr = m_auraStateAuras.begin(); itr != m_auraStateAuras.end(); ++itr)
7529 if ((1 << (itr->first - 1)) & PER_CASTER_AURA_STATE_MASK)
7530 if (itr->second->GetBase()->GetCasterGUID() == target->GetGUID())
7531 auraStates |= (1 << (itr->first - 1));
7532
7533 return auraStates;
7534}
uint32 GetUInt32Value(uint16 index) const
Definition Object.cpp:294

References Object::GetGUID(), Object::GetUInt32Value(), m_auraStateAuras, PER_CASTER_AURA_STATE_MASK, and UNIT_FIELD_AURASTATE.

Referenced by PatchValuesUpdate().

◆ BuildCooldownPacket() [1/2]

void Unit::BuildCooldownPacket ( WorldPacket data,
uint8  flags,
PacketCooldowns const &  cooldowns 
)
17206{
17207 data.Initialize(SMSG_SPELL_COOLDOWN, 8 + 1 + (4 + 4) * cooldowns.size());
17208 data << GetGUID();
17209 data << uint8(flags);
17210 for (std::unordered_map<uint32, uint32>::const_iterator itr = cooldowns.begin(); itr != cooldowns.end(); ++itr)
17211 {
17212 data << uint32(itr->first);
17213 data << uint32(itr->second);
17214 }
17215}
void Initialize(uint16 opcode, std::size_t newres=200)
Definition WorldPacket.h:68
@ SMSG_SPELL_COOLDOWN
Definition Opcodes.h:338

References Object::GetGUID(), WorldPacket::Initialize(), and SMSG_SPELL_COOLDOWN.

◆ BuildCooldownPacket() [2/2]

◆ BuildHeartBeatMsg()

void Unit::BuildHeartBeatMsg ( WorldPacket data) const
2077{
2078 data->Initialize(MSG_MOVE_HEARTBEAT, 32);
2079 *data << GetPackGUID();
2080 BuildMovementPacket(data);
2081}
PackedGuid const & GetPackGUID() const
Definition Object.h:115
void BuildMovementPacket(ByteBuffer *data) const
Definition Unit.cpp:15994
@ MSG_MOVE_HEARTBEAT
Definition Opcodes.h:268

References BuildMovementPacket(), Object::GetPackGUID(), WorldPacket::Initialize(), and MSG_MOVE_HEARTBEAT.

Referenced by SendMovementFlagUpdate().

◆ BuildMovementPacket()

void Unit::BuildMovementPacket ( ByteBuffer data) const
15995{
15996 *data << uint32(GetUnitMovementFlags()); // movement flags
15997 *data << uint16(GetExtraUnitMovementFlags()); // 2.3.0
15998 *data << uint32(GameTime::GetGameTimeMS().count()); // time / counter
15999 *data << GetPositionX();
16000 *data << GetPositionY();
16001 *data << GetPositionZ();
16002 *data << GetOrientation();
16003
16004 // 0x00000200
16006 {
16007 if (m_vehicle)
16008 *data << m_vehicle->GetBase()->GetPackGUID();
16009 else if (GetTransport())
16010 *data << GetTransport()->GetPackGUID();
16011 else
16012 *data << (uint8)0;
16013
16014 *data << float (GetTransOffsetX());
16015 *data << float (GetTransOffsetY());
16016 *data << float (GetTransOffsetZ());
16017 *data << float (GetTransOffsetO());
16018 *data << uint32(GetTransTime());
16019 *data << uint8 (GetTransSeat());
16020
16023 }
16024
16025 // 0x02200000
16028 *data << (float)m_movementInfo.pitch;
16029
16030 *data << (uint32)m_movementInfo.fallTime;
16031
16032 // 0x00001000
16034 {
16035 *data << (float)m_movementInfo.jump.zspeed;
16036 *data << (float)m_movementInfo.jump.sinAngle;
16037 *data << (float)m_movementInfo.jump.cosAngle;
16038 *data << (float)m_movementInfo.jump.xyspeed;
16039 }
16040
16041 // 0x04000000
16043 *data << (float)m_movementInfo.splineElevation;
16044}
std::uint16_t uint16
Definition Define.h:108
@ MOVEMENTFLAG_ONTRANSPORT
Definition UnitDefines.h:378
@ MOVEMENTFLAG_FLYING
Definition UnitDefines.h:394
@ MOVEMENTFLAG_FALLING
Definition UnitDefines.h:381
@ MOVEMENTFLAG_SWIMMING
Definition UnitDefines.h:390
@ MOVEMENTFLAG_SPLINE_ELEVATION
Definition UnitDefines.h:395
@ MOVEMENTFLAG2_ALWAYS_ALLOW_PITCHING
Definition UnitDefines.h:432
@ MOVEMENTFLAG2_INTERPOLATED_MOVEMENT
Definition UnitDefines.h:437
uint32 GetUnitMovementFlags() const
Definition Unit.h:769
uint16 GetExtraUnitMovementFlags() const
Definition Unit.h:775
float GetTransOffsetX() const
Definition Object.h:684
float GetTransOffsetY() const
Definition Object.h:685
float GetTransOffsetZ() const
Definition Object.h:686
uint32 GetTransTime() const
Definition Object.h:688
Transport * GetTransport() const
Definition Object.h:683
float GetTransOffsetO() const
Definition Object.h:687
float cosAngle
Definition Object.h:328
float xyspeed
Definition Object.h:328
float zspeed
Definition Object.h:328
float sinAngle
Definition Object.h:328
uint32 time2
Definition Object.h:311
struct MovementInfo::JumpInfo jump
uint32 fallTime
Definition Object.h:318
struct MovementInfo::TransportInfo transport
float splineElevation
Definition Object.h:332
float pitch
Definition Object.h:315

References MovementInfo::JumpInfo::cosAngle, MovementInfo::fallTime, MovementInfo::flags2, Vehicle::GetBase(), GetExtraUnitMovementFlags(), GameTime::GetGameTimeMS(), Position::GetOrientation(), Object::GetPackGUID(), Position::GetPositionX(), Position::GetPositionY(), Position::GetPositionZ(), WorldObject::GetTransOffsetO(), WorldObject::GetTransOffsetX(), WorldObject::GetTransOffsetY(), WorldObject::GetTransOffsetZ(), WorldObject::GetTransport(), WorldObject::GetTransSeat(), WorldObject::GetTransTime(), GetUnitMovementFlags(), MovementInfo::jump, WorldObject::m_movementInfo, m_vehicle, MOVEMENTFLAG2_ALWAYS_ALLOW_PITCHING, MOVEMENTFLAG2_INTERPOLATED_MOVEMENT, MOVEMENTFLAG_FALLING, MOVEMENTFLAG_FLYING, MOVEMENTFLAG_ONTRANSPORT, MOVEMENTFLAG_SPLINE_ELEVATION, MOVEMENTFLAG_SWIMMING, MovementInfo::pitch, MovementInfo::JumpInfo::sinAngle, MovementInfo::splineElevation, MovementInfo::TransportInfo::time2, MovementInfo::transport, MovementInfo::JumpInfo::xyspeed, and MovementInfo::JumpInfo::zspeed.

Referenced by BuildHeartBeatMsg(), Object::BuildMovementUpdate(), WorldSession::HandleMoveKnockBackAck(), Player::SendTeleportAckPacket(), and SendTeleportPacket().

◆ BuildValuesUpdate()

void Unit::BuildValuesUpdate ( uint8  updateType,
ByteBuffer data,
Player target 
)
overrideprotectedvirtual

Reimplemented from Object.

16919{
16920 if (!target)
16921 return;
16922
16924 uint32 visibleFlag = UF_FLAG_PUBLIC;
16925
16926 if (target == this)
16927 visibleFlag |= UF_FLAG_PRIVATE;
16928
16930 if (GetOwnerGUID() == target->GetGUID())
16931 visibleFlag |= UF_FLAG_OWNER;
16932
16935 visibleFlag |= UF_FLAG_SPECIAL_INFO;
16936
16937 if (plr && plr->IsInSameRaidWith(target))
16938 visibleFlag |= UF_FLAG_PARTY_MEMBER;
16939
16940 uint64 cacheKey = static_cast<uint64>(visibleFlag) << 8 | updateType;
16941
16942 auto cacheIt = _valuesUpdateCache.find(cacheKey);
16943 if (cacheIt != _valuesUpdateCache.end())
16944 {
16945 int32 cachePos = static_cast<int32>(data->wpos());
16946 data->append(cacheIt->second.buffer);
16947
16948 BuildValuesCachePosPointers dataAdjustedPos = cacheIt->second.posPointers;
16949 if (cachePos)
16950 dataAdjustedPos.ApplyOffset(cachePos);
16951
16952 PatchValuesUpdate(*data, dataAdjustedPos, target);
16953
16954 return;
16955 }
16956
16957 BuildValuesCachedBuffer cacheValue(500);
16958
16959 ByteBuffer fieldBuffer(400);
16960
16961 UpdateMask updateMask;
16962 updateMask.SetCount(m_valuesCount);
16963
16964 for (uint16 index = 0; index < m_valuesCount; ++index)
16965 {
16966 if (_fieldNotifyFlags & flags[index] ||
16967 ((flags[index] & visibleFlag) & UF_FLAG_SPECIAL_INFO) ||
16968 ((updateType == UPDATETYPE_VALUES ? _changesMask.GetBit(index) : m_uint32Values[index]) && (flags[index] & visibleFlag)) ||
16970 {
16971 updateMask.SetBit(index);
16972
16973 if (index == UNIT_NPC_FLAGS)
16974 {
16975 cacheValue.posPointers.UnitNPCFlagsPos = int32(fieldBuffer.wpos());
16976 fieldBuffer << m_uint32Values[UNIT_NPC_FLAGS];
16977 }
16978 else if (index == UNIT_FIELD_AURASTATE)
16979 {
16980 cacheValue.posPointers.UnitFieldAuraStatePos = int32(fieldBuffer.wpos());
16981 fieldBuffer << uint32(0); // Fill in later.
16982 }
16983 // FIXME: Some values at server stored in float format but must be sent to client in uint32 format
16984 else if (index >= UNIT_FIELD_BASEATTACKTIME && index <= UNIT_FIELD_RANGEDATTACKTIME)
16985 {
16986 // convert from float to uint32 and send
16987 fieldBuffer << uint32(m_floatValues[index] < 0 ? 0 : m_floatValues[index]);
16988 }
16989 // there are some float values which may be negative or can't get negative due to other checks
16990 else if ((index >= UNIT_FIELD_NEGSTAT0 && index <= UNIT_FIELD_NEGSTAT4) ||
16993 (index >= UNIT_FIELD_POSSTAT0 && index <= UNIT_FIELD_POSSTAT4))
16994 {
16995 fieldBuffer << uint32(m_floatValues[index]);
16996 }
16997 // Gamemasters should be always able to select units - remove not selectable flag
16998 else if (index == UNIT_FIELD_FLAGS)
16999 {
17000 cacheValue.posPointers.UnitFieldFlagsPos = int32(fieldBuffer.wpos());
17001 fieldBuffer << m_uint32Values[UNIT_FIELD_FLAGS];
17002 }
17003 // use modelid_a if not gm, _h if gm for CREATURE_FLAG_EXTRA_TRIGGER creatures
17004 else if (index == UNIT_FIELD_DISPLAYID)
17005 {
17006 cacheValue.posPointers.UnitFieldDisplayPos = int32(fieldBuffer.wpos());
17007 fieldBuffer << m_uint32Values[UNIT_FIELD_DISPLAYID];
17008 }
17009 else if (index == UNIT_DYNAMIC_FLAGS)
17010 {
17011 cacheValue.posPointers.UnitDynamicFlagsPos = int32(fieldBuffer.wpos());
17013 fieldBuffer << dynamicFlags;
17014 }
17015 else if (index == UNIT_FIELD_BYTES_2)
17016 {
17017 cacheValue.posPointers.UnitFieldBytes2Pos = int32(fieldBuffer.wpos());
17018 fieldBuffer << m_uint32Values[index];
17019 }
17020 else if (index == UNIT_FIELD_FACTIONTEMPLATE)
17021 {
17022 cacheValue.posPointers.UnitFieldFactionTemplatePos = int32(fieldBuffer.wpos());
17023 fieldBuffer << m_uint32Values[index];
17024 }
17025 else
17026 {
17027 if (sScriptMgr->ShouldTrackValuesUpdatePosByIndex(this, updateType, index))
17028 cacheValue.posPointers.other[index] = static_cast<uint32>(fieldBuffer.wpos());
17029
17030 // send in current format (float as float, uint32 as uint32)
17031 fieldBuffer << m_uint32Values[index];
17032 }
17033 }
17034 }
17035
17036 cacheValue.buffer << uint8(updateMask.GetBlockCount());
17037 updateMask.AppendToPacket(&cacheValue.buffer);
17038 int32 fieldBufferPos = static_cast<int32>(cacheValue.buffer.wpos());
17039 cacheValue.buffer.append(fieldBuffer);
17040 cacheValue.posPointers.ApplyOffset(fieldBufferPos);
17041
17042 int32 cachePos = static_cast<int32>(data->wpos());
17043 data->append(cacheValue.buffer);
17044
17045 BuildValuesCachePosPointers dataAdjustedPos = cacheValue.posPointers;
17046 if (cachePos)
17047 dataAdjustedPos.ApplyOffset(cachePos);
17048
17049 PatchValuesUpdate(*data, dataAdjustedPos, target);
17050
17051 _valuesUpdateCache.insert(std::pair<uint64, BuildValuesCachedBuffer>(cacheKey, std::move(cacheValue)));
17052}
std::uint64_t uint64
Definition Define.h:106
@ UNIT_DYNFLAG_SPECIALINFO
Definition SharedDefines.h:3365
@ UNIT_DYNFLAG_TAPPED_BY_PLAYER
Definition SharedDefines.h:3364
@ UNIT_DYNFLAG_TAPPED
Definition SharedDefines.h:3363
@ SPELL_AURA_EMPATHY
Definition SpellAuraDefines.h:184
@ UPDATETYPE_VALUES
Definition UpdateData.h:28
uint32 UnitUpdateFieldFlags[PLAYER_END]
Definition UpdateFieldFlags.cpp:162
@ UF_FLAG_SPECIAL_INFO
Definition UpdateFieldFlags.h:32
@ UF_FLAG_PUBLIC
Definition UpdateFieldFlags.h:27
@ UF_FLAG_OWNER
Definition UpdateFieldFlags.h:29
@ UF_FLAG_PRIVATE
Definition UpdateFieldFlags.h:28
@ UF_FLAG_PARTY_MEMBER
Definition UpdateFieldFlags.h:33
@ UNIT_NPC_FLAGS
Definition UpdateFields.h:139
@ UNIT_FIELD_RESISTANCEBUFFMODSPOSITIVE
Definition UpdateFields.h:157
@ UNIT_FIELD_POSSTAT0
Definition UpdateFields.h:146
@ UNIT_FIELD_RANGEDATTACKTIME
Definition UpdateFields.h:121
@ UNIT_FIELD_DISPLAYID
Definition UpdateFields.h:124
@ UNIT_FIELD_FACTIONTEMPLATE
Definition UpdateFields.h:115
@ UNIT_FIELD_POSSTAT4
Definition UpdateFields.h:150
@ UNIT_FIELD_NEGSTAT4
Definition UpdateFields.h:155
@ UNIT_FIELD_FLAGS
Definition UpdateFields.h:117
@ UNIT_FIELD_NEGSTAT0
Definition UpdateFields.h:151
@ UNIT_FIELD_RESISTANCEBUFFMODSNEGATIVE
Definition UpdateFields.h:158
@ UNIT_DYNAMIC_FLAGS
Definition UpdateFields.h:136
Definition ByteBuffer.h:70
void append(T value)
Definition ByteBuffer.h:129
std::size_t wpos() const
Definition ByteBuffer.h:330
uint16 _fieldNotifyFlags
Definition Object.h:267
bool HasDynamicFlag(uint32 flag) const
Definition Object.h:123
UpdateMask _changesMask
Definition Object.h:263
uint32 * m_uint32Values
Definition Object.h:259
uint16 m_valuesCount
Definition Object.h:265
float * m_floatValues
Definition Object.h:260
bool IsInSameRaidWith(Player const *p) const
Definition Player.h:1900
ValuesUpdateCache _valuesUpdateCache
Definition Unit.h:2243
bool HasAuraTypeWithCaster(AuraType auratype, ObjectGuid caster) const
Definition Unit.cpp:5958
ObjectGuid GetOwnerGUID() const
Definition Unit.h:707
void PatchValuesUpdate(ByteBuffer &valuesUpdateBuf, BuildValuesCachePosPointers &posPointers, Player *target)
Definition Unit.cpp:17054
Definition UpdateMask.h:25
uint32 GetBlockCount() const
Definition UpdateMask.h:62
bool GetBit(uint32 index) const
Definition UpdateMask.h:47
void SetCount(uint32 valuesCount)
Definition UpdateMask.h:65
void SetBit(uint32 index)
Definition UpdateMask.h:45
void AppendToPacket(ByteBuffer *data)
Definition UpdateMask.h:49
Definition UnitUtils.h:65
void ApplyOffset(uint32 offset)
Definition UnitUtils.h:70
Definition UnitUtils.h:110

References Object::_changesMask, Object::_fieldNotifyFlags, _valuesUpdateCache, ByteBuffer::append(), UpdateMask::AppendToPacket(), BuildValuesCachePosPointers::ApplyOffset(), BuildValuesCachedBuffer::buffer, UpdateMask::GetBit(), UpdateMask::GetBlockCount(), GetCharmerOrOwnerPlayerOrPlayerItself(), Object::GetGUID(), GetOwnerGUID(), HasAuraTypeWithCaster(), Object::HasDynamicFlag(), Object::HasFlag(), Player::IsInSameRaidWith(), Object::m_floatValues, Object::m_uint32Values, Object::m_valuesCount, BuildValuesCachePosPointers::other, PatchValuesUpdate(), PER_CASTER_AURA_STATE_MASK, BuildValuesCachedBuffer::posPointers, UpdateMask::SetBit(), UpdateMask::SetCount(), SPELL_AURA_EMPATHY, sScriptMgr, UF_FLAG_OWNER, UF_FLAG_PARTY_MEMBER, UF_FLAG_PRIVATE, UF_FLAG_PUBLIC, UF_FLAG_SPECIAL_INFO, UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_SPECIALINFO, UNIT_DYNFLAG_TAPPED, UNIT_DYNFLAG_TAPPED_BY_PLAYER, UNIT_FIELD_AURASTATE, UNIT_FIELD_BASEATTACKTIME, UNIT_FIELD_BYTES_2, UNIT_FIELD_DISPLAYID, UNIT_FIELD_FACTIONTEMPLATE, UNIT_FIELD_FLAGS, UNIT_FIELD_NEGSTAT0, UNIT_FIELD_NEGSTAT4, UNIT_FIELD_POSSTAT0, UNIT_FIELD_POSSTAT4, UNIT_FIELD_RANGEDATTACKTIME, UNIT_FIELD_RESISTANCEBUFFMODSNEGATIVE, UNIT_FIELD_RESISTANCEBUFFMODSPOSITIVE, UNIT_NPC_FLAGS, BuildValuesCachePosPointers::UnitDynamicFlagsPos, BuildValuesCachePosPointers::UnitFieldAuraStatePos, BuildValuesCachePosPointers::UnitFieldBytes2Pos, BuildValuesCachePosPointers::UnitFieldDisplayPos, BuildValuesCachePosPointers::UnitFieldFactionTemplatePos, BuildValuesCachePosPointers::UnitFieldFlagsPos, BuildValuesCachePosPointers::UnitNPCFlagsPos, UnitUpdateFieldFlags, UPDATETYPE_VALUES, and ByteBuffer::wpos().

◆ CalcAbsorbResist()

void Unit::CalcAbsorbResist ( DamageInfo dmgInfo,
bool  Splited = false 
)
static
2272{
2273 Unit* victim = dmgInfo.GetVictim();
2274 Unit* attacker = dmgInfo.GetAttacker();
2275 uint32 damage = dmgInfo.GetDamage();
2276 SpellSchoolMask schoolMask = dmgInfo.GetSchoolMask();
2277 SpellInfo const* spellInfo = dmgInfo.GetSpellInfo();
2278
2279 if (!victim || !victim->IsAlive() || !damage)
2280 return;
2281
2282 // Magic damage, check for resists
2283 // Ignore spells that cant be resisted
2284 // Xinef: holy resistance exists for npcs
2285 if (!(schoolMask & SPELL_SCHOOL_MASK_NORMAL) && (!(schoolMask & SPELL_SCHOOL_MASK_HOLY) || victim->IsCreature()) && (!spellInfo || (!spellInfo->HasAttribute(SPELL_ATTR0_CU_BINARY_SPELL) && !spellInfo->HasAttribute(SPELL_ATTR4_NO_CAST_LOG))))
2286 {
2287 float averageResist = Unit::GetEffectiveResistChance(attacker, schoolMask, victim);
2288
2289 float discreteResistProbability[11];
2290 for (uint32 i = 0; i < 11; ++i)
2291 {
2292 discreteResistProbability[i] = 0.5f - 2.5f * std::fabs(0.1f * i - averageResist);
2293 if (discreteResistProbability[i] < 0.0f)
2294 discreteResistProbability[i] = 0.0f;
2295 }
2296
2297 if (averageResist <= 0.1f)
2298 {
2299 discreteResistProbability[0] = 1.0f - 7.5f * averageResist;
2300 discreteResistProbability[1] = 5.0f * averageResist;
2301 discreteResistProbability[2] = 2.5f * averageResist;
2302 }
2303
2304 float r = float(rand_norm());
2305 uint32 i = 0;
2306 float probabilitySum = discreteResistProbability[0];
2307
2308 while (r >= probabilitySum && i < 10)
2309 probabilitySum += discreteResistProbability[++i];
2310
2311 float damageResisted = float(damage * i / 10);
2312
2313 if (damageResisted) // if equal to 0, checking these is pointless
2314 {
2315 if (attacker)
2316 {
2317 float mult = attacker->GetTotalAuraMultiplier(SPELL_AURA_MOD_ABILITY_IGNORE_TARGET_RESIST, [schoolMask, spellInfo](AuraEffect const* aurEff)
2318 {
2319 if (!(aurEff->GetMiscValue() & schoolMask))
2320 return false;
2321
2322 if (!aurEff->IsAffectedOnSpell(spellInfo))
2323 return false;
2324
2325 return true;
2326 });
2327 damageResisted -= damageResisted * (mult - 1.0f);
2329 damageResisted -= damageResisted * (mult - 1.0f);
2330 }
2331
2332 // pussywizard:
2333 if (spellInfo && spellInfo->HasAttribute(SPELL_ATTR0_CU_SCHOOLMASK_NORMAL_WITH_MAGIC))
2334 {
2335 uint32 damageAfterArmor = Unit::CalcArmorReducedDamage(attacker, victim, damage, spellInfo, 0, BASE_ATTACK);
2336 uint32 armorReduction = damage - damageAfterArmor;
2337 if (armorReduction < damageResisted) // pick the lower one, the weakest resistance counts
2338 damageResisted = armorReduction;
2339 }
2340 }
2341
2342 dmgInfo.ResistDamage(uint32(damageResisted));
2343 }
2344
2345 // Ignore Absorption Auras
2346 float auraAbsorbMod = 0;
2347 if (attacker)
2348 {
2350 auraAbsorbMod = std::max(auraAbsorbMod, float(attacker->GetMaxPositiveAuraModifier(SPELL_AURA_MOD_TARGET_ABILITY_ABSORB_SCHOOL, [spellInfo, schoolMask](AuraEffect const* aurEff)
2351 {
2352 if (!(aurEff->GetMiscValue() & schoolMask))
2353 return false;
2354
2355 if (!aurEff->IsAffectedOnSpell(spellInfo))
2356 return false;
2357
2358 return true;
2359 })));
2360 RoundToInterval(auraAbsorbMod, 0.0f, 100.0f);
2361 }
2362
2363 // We're going to call functions which can modify content of the list during iteration over it's elements
2364 // Let's copy the list so we can prevent iterator invalidation
2366 std::sort(vSchoolAbsorbCopy.begin(), vSchoolAbsorbCopy.end(), Acore::AbsorbAuraOrderPred());
2367
2368 // absorb without mana cost
2369 for (AuraEffectList::iterator itr = vSchoolAbsorbCopy.begin(); (itr != vSchoolAbsorbCopy.end()) && (dmgInfo.GetDamage() > 0); ++itr)
2370 {
2371 AuraEffect* absorbAurEff = *itr;
2372 // Check if aura was removed during iteration - we don't need to work on such auras
2373 AuraApplication const* aurApp = absorbAurEff->GetBase()->GetApplicationOfTarget(victim->GetGUID());
2374 if (!aurApp)
2375 continue;
2376 if (!(absorbAurEff->GetMiscValue() & schoolMask))
2377 continue;
2378
2379 // get amount which can be still absorbed by the aura
2380 int32 currentAbsorb = absorbAurEff->GetAmount();
2381 // aura with infinite absorb amount - let the scripts handle absorbtion amount, set here to 0 for safety
2382 if (currentAbsorb < 0)
2383 currentAbsorb = 0;
2384
2385 uint32 tempAbsorb = uint32(currentAbsorb);
2386
2387 bool defaultPrevented = false;
2388
2389 absorbAurEff->GetBase()->CallScriptEffectAbsorbHandlers(absorbAurEff, aurApp, dmgInfo, tempAbsorb, defaultPrevented);
2390 currentAbsorb = tempAbsorb;
2391
2392 if (defaultPrevented)
2393 continue;
2394
2395 // absorb must be smaller than the damage itself
2396 currentAbsorb = RoundToInterval(currentAbsorb, 0, int32(dmgInfo.GetDamage()));
2397
2398 // xinef: do this after absorb is rounded to damage...
2399 AddPct(currentAbsorb, -auraAbsorbMod);
2400
2401 dmgInfo.AbsorbDamage(currentAbsorb);
2402
2403 tempAbsorb = currentAbsorb;
2404 absorbAurEff->GetBase()->CallScriptEffectAfterAbsorbHandlers(absorbAurEff, aurApp, dmgInfo, tempAbsorb);
2405
2406 // Check if our aura is using amount to count damage
2407 if (absorbAurEff->GetAmount() >= 0)
2408 {
2409 // Reduce shield amount
2410 absorbAurEff->SetAmount(absorbAurEff->GetAmount() - currentAbsorb);
2411 // Aura cannot absorb anything more - remove it
2412 if (absorbAurEff->GetAmount() <= 0)
2413 absorbAurEff->GetBase()->Remove(AURA_REMOVE_BY_ENEMY_SPELL);
2414 }
2415 }
2416
2417 // absorb by mana cost
2419 for (AuraEffectList::const_iterator itr = vManaShieldCopy.begin(); (itr != vManaShieldCopy.end()) && (dmgInfo.GetDamage() > 0); ++itr)
2420 {
2421 AuraEffect* absorbAurEff = *itr;
2422 // Check if aura was removed during iteration - we don't need to work on such auras
2423 AuraApplication const* aurApp = absorbAurEff->GetBase()->GetApplicationOfTarget(victim->GetGUID());
2424 if (!aurApp)
2425 continue;
2426 // check damage school mask
2427 if (!(absorbAurEff->GetMiscValue() & schoolMask))
2428 continue;
2429
2430 // get amount which can be still absorbed by the aura
2431 int32 currentAbsorb = absorbAurEff->GetAmount();
2432 // aura with infinite absorb amount - let the scripts handle absorbtion amount, set here to 0 for safety
2433 if (currentAbsorb < 0)
2434 currentAbsorb = 0;
2435
2436 uint32 tempAbsorb = currentAbsorb;
2437
2438 bool defaultPrevented = false;
2439
2440 absorbAurEff->GetBase()->CallScriptEffectManaShieldHandlers(absorbAurEff, aurApp, dmgInfo, tempAbsorb, defaultPrevented);
2441 currentAbsorb = tempAbsorb;
2442
2443 if (defaultPrevented)
2444 continue;
2445
2446 // absorb must be smaller than the damage itself
2447 currentAbsorb = RoundToInterval(currentAbsorb, 0, int32(dmgInfo.GetDamage()));
2448
2449 // xinef: do this after absorb is rounded to damage...
2450 AddPct(currentAbsorb, -auraAbsorbMod);
2451
2452 int32 manaReduction = currentAbsorb;
2453
2454 // lower absorb amount by talents
2455 if (float manaMultiplier = absorbAurEff->GetSpellInfo()->Effects[absorbAurEff->GetEffIndex()].CalcValueMultiplier(absorbAurEff->GetCaster()))
2456 manaReduction = int32(float(manaReduction) * manaMultiplier);
2457
2458 int32 manaTaken = -victim->ModifyPower(POWER_MANA, -manaReduction);
2459
2460 // take case when mana has ended up into account
2461 currentAbsorb = currentAbsorb ? int32(float(currentAbsorb) * (float(manaTaken) / float(manaReduction))) : 0;
2462
2463 dmgInfo.AbsorbDamage(currentAbsorb);
2464
2465 tempAbsorb = currentAbsorb;
2466 absorbAurEff->GetBase()->CallScriptEffectAfterManaShieldHandlers(absorbAurEff, aurApp, dmgInfo, tempAbsorb);
2467
2468 // Check if our aura is using amount to count damage
2469 if (absorbAurEff->GetAmount() >= 0)
2470 {
2471 absorbAurEff->SetAmount(absorbAurEff->GetAmount() - currentAbsorb);
2472 if ((absorbAurEff->GetAmount() <= 0))
2473 absorbAurEff->GetBase()->Remove(AURA_REMOVE_BY_ENEMY_SPELL);
2474 }
2475 }
2476
2477 // split damage auras - only when not damaging self
2478 // Xinef: not true - Warlock Hellfire
2479 if (/*victim != attacker &&*/ !Splited)
2480 {
2481 // We're going to call functions which can modify content of the list during iteration over it's elements
2482 // Let's copy the list so we can prevent iterator invalidation
2483 AuraEffectList vSplitDamageFlatCopy(victim->GetAuraEffectsByType(SPELL_AURA_SPLIT_DAMAGE_FLAT)); // Not used by any spell
2484 for (AuraEffectList::iterator itr = vSplitDamageFlatCopy.begin(); (itr != vSplitDamageFlatCopy.end()) && (dmgInfo.GetDamage() > 0); ++itr)
2485 {
2486 // Check if aura was removed during iteration - we don't need to work on such auras
2487 if (!((*itr)->GetBase()->IsAppliedOnTarget(victim->GetGUID())))
2488 continue;
2489 // check damage school mask
2490 if (!((*itr)->GetMiscValue() & schoolMask))
2491 continue;
2492
2493 // Damage can be splitted only if aura has an alive caster
2494 Unit* caster = (*itr)->GetCaster();
2495 if (!caster || (caster == victim) || !caster->IsInWorld() || !caster->IsAlive())
2496 continue;
2497
2498 // Limit effect range to spell's cast range. (Only for single target auras, AreaAuras don't need it)
2499 // Ignore LOS attribute is only used for the cast portion of the spell
2500 SpellInfo const* splitSpellInfo = (*itr)->GetSpellInfo();
2501 if (!splitSpellInfo->Effects[(*itr)->GetEffIndex()].IsAreaAuraEffect())
2502 if (!caster->IsWithinDist(victim, splitSpellInfo->GetMaxRange(splitSpellInfo->IsPositive(), caster)))
2503 continue;
2504
2505 int32 splitDamage = (*itr)->GetAmount();
2506
2507 // absorb must be smaller than the damage itself
2508 splitDamage = RoundToInterval(splitDamage, 0, int32(dmgInfo.GetDamage()));
2509
2510 dmgInfo.AbsorbDamage(splitDamage);
2511
2512 uint32 splitted = splitDamage;
2513 uint32 splitted_absorb = 0;
2514 uint32 splitted_resist = 0;
2515
2516 uint32 procAttacker = 0, procVictim = 0;
2517 DamageInfo splittedDmgInfo(attacker, caster, splitted, spellInfo, schoolMask, dmgInfo.GetDamageType());
2518 splittedDmgInfo.AddHitMask(PROC_HIT_NORMAL);
2519 if (caster->IsImmunedToDamageOrSchool(schoolMask))
2520 {
2521 splittedDmgInfo.AddHitMask(PROC_HIT_IMMUNE);
2522 splittedDmgInfo.AbsorbDamage(splitted);
2523 }
2524 else
2525 {
2526 Unit::CalcAbsorbResist(splittedDmgInfo, true);
2527 Unit::DealDamageMods(caster, splitted, &splitted_absorb);
2528 }
2529
2530 splitted_absorb = splittedDmgInfo.GetAbsorb();
2531 splitted_resist = splittedDmgInfo.GetResist();
2532 splitted = splittedDmgInfo.GetDamage();
2533
2534 // Add absorb to hitMask if damage was absorbed
2535 if (splittedDmgInfo.GetAbsorb())
2536 splittedDmgInfo.AddHitMask(PROC_HIT_ABSORB);
2537
2538 // create procs
2539 createProcFlags(spellInfo, BASE_ATTACK, false, procAttacker, procVictim);
2540 caster->ProcSkillsAndReactives(true, attacker, procVictim, splittedDmgInfo.GetHitMask(), BASE_ATTACK, spellInfo, splitted, nullptr, -1, nullptr, &splittedDmgInfo);
2541
2542 if (attacker)
2543 {
2544 attacker->SendSpellNonMeleeDamageLog(caster, (*itr)->GetSpellInfo(), splitted, schoolMask, splitted_absorb, splitted_resist, false, 0, false, true);
2545 }
2546
2547 CleanDamage cleanDamage = CleanDamage(splitted, 0, BASE_ATTACK, MELEE_HIT_NORMAL);
2548 Unit::DealDamage(attacker, caster, splitted, &cleanDamage, DIRECT_DAMAGE, schoolMask, (*itr)->GetSpellInfo(), false);
2549 }
2550
2551 // We're going to call functions which can modify content of the list during iteration over it's elements
2552 // Let's copy the list so we can prevent iterator invalidation
2554 for (AuraEffectList::iterator itr = vSplitDamagePctCopy.begin(); (itr != vSplitDamagePctCopy.end()) && (dmgInfo.GetDamage() > 0); ++itr)
2555 {
2556 // Check if aura was removed during iteration - we don't need to work on such auras
2557 AuraApplication const* aurApp = (*itr)->GetBase()->GetApplicationOfTarget(victim->GetGUID());
2558 if (!aurApp)
2559 continue;
2560
2561 // check damage school mask
2562 if (!((*itr)->GetMiscValue() & schoolMask))
2563 continue;
2564
2565 // Damage can be splitted only if aura has an alive caster
2566 Unit* caster = (*itr)->GetCaster();
2567 if (!caster || (caster == victim) || !caster->IsInWorld() || !caster->IsAlive())
2568 continue;
2569
2570 // Limit effect range to spell's cast range. (Only for single target auras, AreaAuras don't need it)
2571 // Ignore LOS attribute is only used for the cast portion of the spell
2572 SpellInfo const* splitSpellInfo = (*itr)->GetSpellInfo();
2573 if (!splitSpellInfo->Effects[(*itr)->GetEffIndex()].IsAreaAuraEffect())
2574 if (!caster->IsWithinDist(victim, splitSpellInfo->GetMaxRange(splitSpellInfo->IsPositive(), caster)))
2575 continue;
2576
2577 uint32 splitDamage = CalculatePct(dmgInfo.GetDamage(), (*itr)->GetAmount());
2578 SpellSchoolMask splitSchoolMask = schoolMask;
2579
2580 (*itr)->GetBase()->CallScriptEffectSplitHandlers(*itr, aurApp, dmgInfo, splitDamage);
2581
2582 // absorb must be smaller than the damage itself
2583 splitDamage = RoundToInterval(splitDamage, uint32(0), uint32(dmgInfo.GetDamage()));
2584
2585 // Roar of Sacrifice, dont absorb it
2586 if (splitSpellInfo->Id != 53480)
2587 dmgInfo.AbsorbDamage(splitDamage);
2588 else
2589 splitSchoolMask = SPELL_SCHOOL_MASK_NATURE;
2590
2591 uint32 splitted = splitDamage;
2592 uint32 splitted_absorb = 0;
2593 uint32 splitted_resist = 0;
2594
2595 uint32 procAttacker = 0, procVictim = 0;
2596 DamageInfo splittedDmgInfo(attacker, caster, splitted, spellInfo, splitSchoolMask, dmgInfo.GetDamageType());
2597 splittedDmgInfo.AddHitMask(PROC_HIT_NORMAL);
2598 if (caster->IsImmunedToDamageOrSchool(schoolMask))
2599 {
2600 splittedDmgInfo.AddHitMask(PROC_HIT_IMMUNE);
2601 splittedDmgInfo.AbsorbDamage(splitted);
2602 }
2603 else
2604 {
2605 Unit::CalcAbsorbResist(splittedDmgInfo, true);
2606 Unit::DealDamageMods(caster, splitted, &splitted_absorb);
2607 }
2608
2609 splitted_absorb = splittedDmgInfo.GetAbsorb();
2610 splitted_resist = splittedDmgInfo.GetResist();
2611 splitted = splittedDmgInfo.GetDamage();
2612
2613 // Add absorb to hitMask if damage was absorbed
2614 if (splittedDmgInfo.GetAbsorb())
2615 splittedDmgInfo.AddHitMask(PROC_HIT_ABSORB);
2616
2617 // create procs
2618 createProcFlags(spellInfo, BASE_ATTACK, false, procAttacker, procVictim);
2619 caster->ProcSkillsAndReactives(true, attacker, procVictim, splittedDmgInfo.GetHitMask(), BASE_ATTACK, spellInfo, splitted);
2620
2621 if (attacker)
2622 {
2623 attacker->SendSpellNonMeleeDamageLog(caster, splitSpellInfo, splitted, splitSchoolMask, splitted_absorb, splitted_resist, false, 0, false, true);
2624 }
2625
2626 CleanDamage cleanDamage = CleanDamage(splitted, 0, BASE_ATTACK, MELEE_HIT_NORMAL);
2627 Unit::DealDamage(attacker, caster, splitted, &cleanDamage, DIRECT_DAMAGE, splitSchoolMask, splitSpellInfo, false);
2628 }
2629 }
2630}
double rand_norm()
Definition Random.cpp:85
@ POWER_MANA
Definition SharedDefines.h:280
@ SPELL_ATTR4_NO_CAST_LOG
Definition SharedDefines.h:541
SpellSchoolMask
Definition SharedDefines.h:306
@ SPELL_SCHOOL_MASK_NORMAL
Definition SharedDefines.h:308
@ SPELL_SCHOOL_MASK_NATURE
Definition SharedDefines.h:311
@ SPELL_SCHOOL_MASK_HOLY
Definition SharedDefines.h:309
@ SPELL_AURA_MANA_SHIELD
Definition SpellAuraDefines.h:160
@ SPELL_AURA_MOD_TARGET_ABSORB_SCHOOL
Definition SpellAuraDefines.h:257
@ SPELL_AURA_MOD_IGNORE_TARGET_RESIST
Definition SpellAuraDefines.h:332
@ SPELL_AURA_SPLIT_DAMAGE_FLAT
Definition SpellAuraDefines.h:216
@ SPELL_AURA_MOD_TARGET_ABILITY_ABSORB_SCHOOL
Definition SpellAuraDefines.h:258
@ SPELL_AURA_SPLIT_DAMAGE_PCT
Definition SpellAuraDefines.h:144
@ SPELL_AURA_SCHOOL_ABSORB
Definition SpellAuraDefines.h:132
@ SPELL_AURA_MOD_ABILITY_IGNORE_TARGET_RESIST
Definition SpellAuraDefines.h:333
@ AURA_REMOVE_BY_ENEMY_SPELL
Definition SpellAuraDefines.h:394
@ SPELL_ATTR0_CU_BINARY_SPELL
Definition SpellInfo.h:196
@ SPELL_ATTR0_CU_SCHOOLMASK_NORMAL_WITH_MAGIC
Definition SpellInfo.h:199
@ PROC_HIT_IMMUNE
Definition SpellMgr.h:262
@ PROC_HIT_ABSORB
Definition SpellMgr.h:264
@ PROC_HIT_NORMAL
Definition SpellMgr.h:254
void createProcFlags(SpellInfo const *spellInfo, WeaponAttackType attackType, bool positive, uint32 &procAttacker, uint32 &procVictim)
Definition Unit.cpp:12830
@ DIRECT_DAMAGE
Definition Unit.h:255
@ MELEE_HIT_NORMAL
Definition Unit.h:293
T RoundToInterval(T &num, T floor, T ceil)
Definition Util.h:70
Definition SpellAuraEffects.h:349
Definition SpellAuraEffects.h:39
SpellInfo const * GetSpellInfo() const
Definition SpellAuraEffects.h:54
bool IsAffectedOnSpell(SpellInfo const *spell) const
Definition SpellAuraEffects.cpp:1091
void SetAmount(int32 amount)
Definition SpellAuraEffects.h:66
Unit * GetCaster() const
Definition SpellAuraEffects.h:47
int32 GetMiscValue() const
Definition SpellAuraEffects.cpp:442
Aura * GetBase() const
Definition SpellAuraEffects.h:49
uint32 GetEffIndex() const
Definition SpellAuraEffects.h:56
int32 GetAmount() const
Definition SpellAuraEffects.h:64
void CallScriptEffectAbsorbHandlers(AuraEffect *aurEff, AuraApplication const *aurApp, DamageInfo &dmgInfo, uint32 &absorbAmount, bool &defaultPrevented)
Definition SpellAuras.cpp:2562
void CallScriptEffectAfterAbsorbHandlers(AuraEffect *aurEff, AuraApplication const *aurApp, DamageInfo &dmgInfo, uint32 &absorbAmount)
Definition SpellAuras.cpp:2580
void CallScriptEffectManaShieldHandlers(AuraEffect *aurEff, AuraApplication const *aurApp, DamageInfo &dmgInfo, uint32 &absorbAmount, bool &defaultPrevented)
Definition SpellAuras.cpp:2594
void CallScriptEffectAfterManaShieldHandlers(AuraEffect *aurEff, AuraApplication const *aurApp, DamageInfo &dmgInfo, uint32 &absorbAmount)
Definition SpellAuras.cpp:2608
void ResistDamage(uint32 amount)
Definition Unit.cpp:250
void AbsorbDamage(uint32 amount)
Definition Unit.cpp:243
Unit * GetVictim() const
Definition Unit.h:368
Unit * GetAttacker() const
Definition Unit.h:367
SpellInfo const * GetSpellInfo() const
Definition Unit.h:369
DamageEffectType GetDamageType() const
Definition Unit.h:371
SpellSchoolMask GetSchoolMask() const
Definition Unit.h:370
uint32 GetDamage() const
Definition Unit.h:373
std::array< SpellEffectInfo, MAX_SPELL_EFFECTS > Effects
Definition SpellInfo.h:393
float GetMaxRange(bool positive=false, Unit *caster=nullptr, Spell *spell=nullptr) const
Definition SpellInfo.cpp:2216
bool IsPositive() const
Definition SpellInfo.cpp:1237
int32 ModifyPower(Powers power, int32 val, bool withPowerUpdate=true)
Definition Unit.cpp:11097
int32 GetMaxPositiveAuraModifierByMiscMask(AuraType auratype, uint32 misc_mask, const AuraEffect *except=nullptr) const
Definition Unit.cpp:6272
AuraEffectList const & GetAuraEffectsByType(AuraType type) const
Definition Unit.h:1417
std::vector< AuraEffect * > AuraEffectList
Definition Unit.h:674
static uint32 CalcArmorReducedDamage(Unit const *attacker, Unit const *victim, const uint32 damage, SpellInfo const *spellInfo, uint8 attackerLevel=0, WeaponAttackType attackType=MAX_ATTACK)
Definition Unit.cpp:2155
static float GetEffectiveResistChance(Unit const *owner, SpellSchoolMask schoolMask, Unit const *victim)
Definition Unit.cpp:2237
float GetTotalAuraMultiplier(AuraType auratype) const
Definition Unit.cpp:6237
int32 GetMaxPositiveAuraModifier(AuraType auratype) const
Definition Unit.cpp:6242
void SendSpellNonMeleeDamageLog(SpellNonMeleeDamage *log)
Definition Unit.cpp:6643
float GetTotalAuraMultiplierByMiscMask(AuraType auratype, uint32 misc_mask) const
Definition Unit.cpp:6262
void ProcSkillsAndReactives(bool isVictim, Unit *target, uint32 procFlag, uint32 procExtra, WeaponAttackType attType, SpellInfo const *procSpellInfo, uint32 damage, SpellInfo const *procAura=nullptr, int8 procAuraEffectIndex=-1, Spell const *procSpell=nullptr, DamageInfo *damageInfo=nullptr, HealInfo *healInfo=nullptr, uint32 procPhase=2)
Definition Unit.cpp:12904
bool IsImmunedToDamageOrSchool(SpellSchoolMask meleeSchoolMask) const
Definition Unit.cpp:9842
static void CalcAbsorbResist(DamageInfo &dmgInfo, bool Splited=false)
Definition Unit.cpp:2271
static uint32 DealDamage(Unit *attacker, Unit *victim, uint32 damage, CleanDamage const *cleanDamage=nullptr, DamageEffectType damagetype=DIRECT_DAMAGE, SpellSchoolMask damageSchoolMask=SPELL_SCHOOL_MASK_NORMAL, SpellInfo const *spellProto=nullptr, bool durabilityLoss=true, bool allowGM=false, Spell const *spell=nullptr)
Definition Unit.cpp:932
bool IsWithinDist(WorldObject const *obj, float dist2compare, bool is3D=true, bool incOwnRadius=true, bool incTargetRadius=true) const
Definition Object.cpp:1342
Definition Unit.h:322

References DamageInfo::AbsorbDamage(), DamageInfo::AddHitMask(), AddPct(), AURA_REMOVE_BY_ENEMY_SPELL, BASE_ATTACK, CalcAbsorbResist(), CalcArmorReducedDamage(), CalculatePct(), Aura::CallScriptEffectAbsorbHandlers(), Aura::CallScriptEffectAfterAbsorbHandlers(), Aura::CallScriptEffectAfterManaShieldHandlers(), Aura::CallScriptEffectManaShieldHandlers(), createProcFlags(), DealDamage(), DealDamageMods(), DIRECT_DAMAGE, SpellInfo::Effects, DamageInfo::GetAbsorb(), AuraEffect::GetAmount(), Aura::GetApplicationOfTarget(), DamageInfo::GetAttacker(), GetAuraEffectsByType(), AuraEffect::GetBase(), AuraApplication::GetBase(), AuraEffect::GetCaster(), DamageInfo::GetDamage(), DamageInfo::GetDamageType(), GetEffectiveResistChance(), AuraEffect::GetEffIndex(), Object::GetGUID(), DamageInfo::GetHitMask(), GetMaxPositiveAuraModifier(), GetMaxPositiveAuraModifierByMiscMask(), SpellInfo::GetMaxRange(), AuraEffect::GetMiscValue(), DamageInfo::GetResist(), DamageInfo::GetSchoolMask(), DamageInfo::GetSpellInfo(), AuraEffect::GetSpellInfo(), GetTotalAuraMultiplier(), GetTotalAuraMultiplierByMiscMask(), DamageInfo::GetVictim(), SpellInfo::HasAttribute(), SpellInfo::Id, AuraEffect::IsAffectedOnSpell(), IsAlive(), Object::IsCreature(), IsImmunedToDamageOrSchool(), Object::IsInWorld(), SpellInfo::IsPositive(), WorldObject::IsWithinDist(), MELEE_HIT_NORMAL, ModifyPower(), POWER_MANA, PROC_HIT_ABSORB, PROC_HIT_IMMUNE, PROC_HIT_NORMAL, ProcSkillsAndReactives(), rand_norm(), Aura::Remove(), DamageInfo::ResistDamage(), RoundToInterval(), SendSpellNonMeleeDamageLog(), AuraEffect::SetAmount(), SPELL_ATTR0_CU_BINARY_SPELL, SPELL_ATTR0_CU_SCHOOLMASK_NORMAL_WITH_MAGIC, SPELL_ATTR4_NO_CAST_LOG, SPELL_AURA_MANA_SHIELD, SPELL_AURA_MOD_ABILITY_IGNORE_TARGET_RESIST, SPELL_AURA_MOD_IGNORE_TARGET_RESIST, SPELL_AURA_MOD_TARGET_ABILITY_ABSORB_SCHOOL, SPELL_AURA_MOD_TARGET_ABSORB_SCHOOL, SPELL_AURA_SCHOOL_ABSORB, SPELL_AURA_SPLIT_DAMAGE_FLAT, SPELL_AURA_SPLIT_DAMAGE_PCT, SPELL_SCHOOL_MASK_HOLY, SPELL_SCHOOL_MASK_NATURE, and SPELL_SCHOOL_MASK_NORMAL.

Referenced by CalcAbsorbResist(), CalculateMeleeDamage(), CalculateSpellDamageTaken(), DealDamage(), DealDamageShieldDamage(), Player::EnvironmentalDamage(), spell_valkyr_touch_aura::HandleEffectPeriodic(), AuraEffect::HandlePeriodicDamageAurasTick(), and AuraEffect::HandlePeriodicHealthLeechAuraTick().

◆ CalcArmorReducedDamage()

uint32 Unit::CalcArmorReducedDamage ( Unit const *  attacker,
Unit const *  victim,
const uint32  damage,
SpellInfo const *  spellInfo,
uint8  attackerLevel = 0,
WeaponAttackType  attackType = MAX_ATTACK 
)
static
2156{
2157 float armor = float(victim->GetArmor());
2158
2159 // Ignore enemy armor by SPELL_AURA_MOD_TARGET_RESISTANCE aura
2160 if (attacker)
2161 {
2162 armor += attacker->GetTotalAuraModifierByMiscMask(SPELL_AURA_MOD_TARGET_RESISTANCE, SPELL_SCHOOL_MASK_NORMAL);
2163
2164 if (spellInfo)
2165 if (Player* modOwner = attacker->GetSpellModOwner())
2166 modOwner->ApplySpellMod(spellInfo->Id, SPELLMOD_IGNORE_ARMOR, armor);
2167
2168 AuraEffectList const& ResIgnoreAurasAb = attacker->GetAuraEffectsByType(SPELL_AURA_MOD_ABILITY_IGNORE_TARGET_RESIST);
2169 for (AuraEffectList::const_iterator j = ResIgnoreAurasAb.begin(); j != ResIgnoreAurasAb.end(); ++j)
2170 {
2171 if ((*j)->GetMiscValue() & SPELL_SCHOOL_MASK_NORMAL
2172 && (*j)->IsAffectedOnSpell(spellInfo))
2173 armor = std::floor(AddPct(armor, -(*j)->GetAmount()));
2174 }
2175
2176 AuraEffectList const& ResIgnoreAuras = attacker->GetAuraEffectsByType(SPELL_AURA_MOD_IGNORE_TARGET_RESIST);
2177 for (AuraEffectList::const_iterator j = ResIgnoreAuras.begin(); j != ResIgnoreAuras.end(); ++j)
2178 {
2179 if ((*j)->GetMiscValue() & SPELL_SCHOOL_MASK_NORMAL)
2180 armor = std::floor(AddPct(armor, -(*j)->GetAmount()));
2181 }
2182
2183 // Apply Player CR_ARMOR_PENETRATION rating and buffs from stances\specializations etc.
2184 if (attacker->IsPlayer())
2185 {
2186 float bonusPct = 0;
2187 bonusPct += attacker->GetTotalAuraModifier(SPELL_AURA_MOD_ARMOR_PENETRATION_PCT, [spellInfo,attacker](AuraEffect const* aurEff)
2188 {
2189 if (aurEff->GetSpellInfo()->EquippedItemClass == -1)
2190 {
2191 if (!spellInfo || aurEff->IsAffectedOnSpell(spellInfo) || aurEff->GetMiscValue() & spellInfo->GetSchoolMask())
2192 return true;
2193 else if (!aurEff->GetMiscValue() && !aurEff->HasSpellClassMask())
2194 return true;
2195 }
2196 else
2197 {
2198 if (attacker->ToPlayer()->HasItemFitToSpellRequirements(aurEff->GetSpellInfo()))
2199 return true;
2200 }
2201 return false;
2202 });
2203
2204 float maxArmorPen = 0;
2205 if (victim->GetLevel() < 60)
2206 maxArmorPen = float(400 + 85 * victim->GetLevel());
2207 else
2208 maxArmorPen = 400 + 85 * victim->GetLevel() + 4.5f * 85 * (victim->GetLevel() - 59);
2209
2210 // Cap armor penetration to this number
2211 maxArmorPen = std::min((armor + maxArmorPen) / 3, armor);
2212 // Figure out how much armor do we ignore
2213 float armorPen = CalculatePct(maxArmorPen, bonusPct + attacker->ToPlayer()->GetRatingBonusValue(CR_ARMOR_PENETRATION));
2214 // Got the value, apply it
2215 armor -= std::min(armorPen, maxArmorPen);
2216 }
2217 }
2218
2219 if (armor < 0.0f)
2220 armor = 0.0f;
2221
2222 float levelModifier = attacker ? attacker->GetLevel() : attackerLevel;
2223 if (levelModifier > 59)
2224 levelModifier = levelModifier + (4.5f * (levelModifier - 59));
2225
2226 float tmpvalue = 0.1f * armor / (8.5f * levelModifier + 40);
2227 tmpvalue = tmpvalue / (1.0f + tmpvalue);
2228
2229 if (tmpvalue < 0.0f)
2230 tmpvalue = 0.0f;
2231 if (tmpvalue > 0.75f)
2232 tmpvalue = 0.75f;
2233
2234 return uint32(std::ceil(std::max(damage * (1.0f - tmpvalue), 0.0f)));
2235}
@ SPELL_AURA_MOD_ARMOR_PENETRATION_PCT
Definition SpellAuraDefines.h:343
@ SPELL_AURA_MOD_TARGET_RESISTANCE
Definition SpellAuraDefines.h:186
@ SPELLMOD_IGNORE_ARMOR
Definition SpellDefines.h:89
@ CR_ARMOR_PENETRATION
Definition Unit.h:248
bool HasSpellClassMask() const
Definition SpellAuraEffects.cpp:1105
int32 EquippedItemClass
Definition SpellInfo.h:375

References AddPct(), CalculatePct(), CR_ARMOR_PENETRATION, SpellInfo::EquippedItemClass, GetArmor(), GetAuraEffectsByType(), GetLevel(), AuraEffect::GetMiscValue(), Player::GetRatingBonusValue(), SpellInfo::GetSchoolMask(), AuraEffect::GetSpellInfo(), GetSpellModOwner(), GetTotalAuraModifier(), GetTotalAuraModifierByMiscMask(), Player::HasItemFitToSpellRequirements(), AuraEffect::HasSpellClassMask(), SpellInfo::Id, AuraEffect::IsAffectedOnSpell(), Object::IsPlayer(), SPELL_AURA_MOD_ABILITY_IGNORE_TARGET_RESIST, SPELL_AURA_MOD_ARMOR_PENETRATION_PCT, SPELL_AURA_MOD_IGNORE_TARGET_RESIST, SPELL_AURA_MOD_TARGET_RESISTANCE, SPELL_SCHOOL_MASK_NORMAL, SPELLMOD_IGNORE_ARMOR, and Object::ToPlayer().

Referenced by CalcAbsorbResist(), CalculateMeleeDamage(), CalculateSpellDamageTaken(), boss_priestess_lackey_commonAI::GetThreatMod(), boss_faction_championsAI::GetThreatMod(), AuraEffect::HandlePeriodicDamageAurasTick(), and AuraEffect::HandlePeriodicHealthLeechAuraTick().

◆ CalcHealAbsorb()

void Unit::CalcHealAbsorb ( HealInfo healInfo)
static
2633{
2634 if (!healInfo.GetHeal())
2635 return;
2636
2637 int32 const healing = static_cast<int32>(healInfo.GetHeal());
2638 int32 absorbAmount = 0;
2639
2640 // Need remove expired auras after
2641 bool existExpired = false;
2642
2643 // absorb without mana cost
2645 for (AuraEffectList::const_iterator i = vHealAbsorb.begin(); i != vHealAbsorb.end() && absorbAmount <= healing; ++i)
2646 {
2647 if (!((*i)->GetMiscValue() & healInfo.GetSpellInfo()->SchoolMask))
2648 continue;
2649
2650 // Max Amount can be absorbed by this aura
2651 int32 currentAbsorb = (*i)->GetAmount();
2652
2653 // Found empty aura (impossible but..)
2654 if (currentAbsorb <= 0)
2655 {
2656 existExpired = true;
2657 continue;
2658 }
2659
2660 // currentAbsorb - damage can be absorbed by shield
2661 // If need absorb less damage
2662 if (healing < currentAbsorb + absorbAmount)
2663 currentAbsorb = healing - absorbAmount;
2664
2665 absorbAmount += currentAbsorb;
2666
2667 // Reduce shield amount
2668 (*i)->SetAmount((*i)->GetAmount() - currentAbsorb);
2669 // Need remove it later
2670 if ((*i)->GetAmount() <= 0)
2671 existExpired = true;
2672 }
2673
2674 // Remove all expired absorb auras
2675 if (existExpired)
2676 {
2677 for (AuraEffectList::const_iterator i = vHealAbsorb.begin(); i != vHealAbsorb.end();)
2678 {
2679 AuraEffect* auraEff = *i;
2680 ++i;
2681 if (auraEff->GetAmount() <= 0)
2682 {
2683 uint32 removedAuras = healInfo.GetTarget()->m_removedAurasCount;
2685 if (healInfo.GetTarget()->m_removedAurasCount > removedAuras)
2686 i = vHealAbsorb.begin();
2687 }
2688 }
2689 }
2690
2691 if (absorbAmount > 0)
2692 healInfo.AbsorbHeal(absorbAmount);
2693}
@ SPELL_AURA_SCHOOL_HEAL_ABSORB
Definition SpellAuraDefines.h:364
SpellInfo const * GetSpellInfo() const
Definition Unit.h:427
void AbsorbHeal(uint32 amount)
Definition Unit.h:402
Unit * GetTarget() const
Definition Unit.h:423
uint32 GetHeal() const
Definition Unit.h:424
uint32 SchoolMask
Definition SpellInfo.h:392

References HealInfo::AbsorbHeal(), AURA_REMOVE_BY_ENEMY_SPELL, AuraEffect::GetAmount(), GetAuraEffectsByType(), AuraEffect::GetBase(), HealInfo::GetHeal(), HealInfo::GetSpellInfo(), HealInfo::GetTarget(), m_removedAurasCount, Aura::Remove(), SpellInfo::SchoolMask, and SPELL_AURA_SCHOOL_HEAL_ABSORB.

Referenced by AuraEffect::HandlePeriodicHealAurasTick(), and HealBySpell().

◆ CalcSpellDuration()

int32 Unit::CalcSpellDuration ( SpellInfo const *  spellProto)
11737{
11738 uint8 comboPoints = GetComboPoints();
11739
11740 int32 minduration = spellProto->GetDuration();
11741 int32 maxduration = spellProto->GetMaxDuration();
11742
11743 int32 duration;
11744
11745 if (comboPoints && minduration != -1 && minduration != maxduration)
11746 duration = minduration + int32((maxduration - minduration) * comboPoints / 5);
11747 else
11748 duration = minduration;
11749
11750 return duration;
11751}
uint8 GetComboPoints(Unit const *who=nullptr) const
Definition Unit.h:1003

References GetComboPoints(), SpellInfo::GetDuration(), and SpellInfo::GetMaxDuration().

Referenced by Aura::CalcMaxDuration(), Spell::EffectInterruptCast(), Spell::EffectSchoolDMG(), and Aura::HandleAuraSpecificMods().

◆ CalculateAOEDamageReduction()

int32 Unit::CalculateAOEDamageReduction ( int32  damage,
uint32  schoolMask,
bool  npcCaster 
) const
16489{
16490 damage = int32(float(damage) * GetTotalAuraMultiplierByMiscMask(SPELL_AURA_MOD_AOE_DAMAGE_AVOIDANCE, schoolMask));
16491 if (npcCaster)
16493
16494 return damage;
16495}
@ SPELL_AURA_MOD_CREATURE_AOE_DAMAGE_AVOIDANCE
Definition SpellAuraDefines.h:373
@ SPELL_AURA_MOD_AOE_DAMAGE_AVOIDANCE
Definition SpellAuraDefines.h:292

References GetTotalAuraMultiplierByMiscMask(), SPELL_AURA_MOD_AOE_DAMAGE_AVOIDANCE, and SPELL_AURA_MOD_CREATURE_AOE_DAMAGE_AVOIDANCE.

Referenced by Spell::DoAllEffectOnLaunchTarget(), AuraEffect::HandlePeriodicDamageAurasTick(), and spell_dk_death_and_decay::RecalculateDamage().

◆ CalculateDamage()

uint32 Unit::CalculateDamage ( WeaponAttackType  attType,
bool  normalized,
bool  addTotalPct,
uint8  itemDamagesMask = 0 
)
3115{
3116 float minDamage = 0.0f;
3117 float maxDamage = 0.0f;
3118
3119 if (normalized || !addTotalPct || itemDamagesMask)
3120 {
3121 // get both by default
3122 if (!itemDamagesMask)
3123 {
3124 itemDamagesMask = (1 << 0) | (1 << 1);
3125 }
3126
3127 for (uint8 i = 0; i < MAX_ITEM_PROTO_DAMAGES; ++i)
3128 {
3129 if (itemDamagesMask & (1 << i))
3130 {
3131 float minTmp, maxTmp;
3132 CalculateMinMaxDamage(attType, normalized, addTotalPct, minTmp, maxTmp, i);
3133 minDamage += minTmp;
3134 maxDamage += maxTmp;
3135 }
3136 }
3137 }
3138 else
3139 {
3140 switch (attType)
3141 {
3142 case RANGED_ATTACK:
3145 break;
3146 case BASE_ATTACK:
3149 break;
3150 case OFF_ATTACK:
3153 break;
3154 default:
3155 break;
3156 }
3157 }
3158
3159 minDamage = std::max(0.f, minDamage);
3160 maxDamage = std::max(0.f, maxDamage);
3161
3162 if (minDamage > maxDamage)
3163 {
3164 std::swap(minDamage, maxDamage);
3165 }
3166
3167 return urand(uint32(minDamage), uint32(maxDamage));
3168}
uint32 urand(uint32 min, uint32 max)
Definition Random.cpp:44
@ UNIT_FIELD_MINDAMAGE
Definition UpdateFields.h:127
@ UNIT_FIELD_MAXDAMAGE
Definition UpdateFields.h:128
@ UNIT_FIELD_MAXOFFHANDDAMAGE
Definition UpdateFields.h:130
@ UNIT_FIELD_MAXRANGEDDAMAGE
Definition UpdateFields.h:169
@ UNIT_FIELD_MINRANGEDDAMAGE
Definition UpdateFields.h:168
@ UNIT_FIELD_MINOFFHANDDAMAGE
Definition UpdateFields.h:129
virtual void CalculateMinMaxDamage(WeaponAttackType attType, bool normalized, bool addTotalPct, float &minDamage, float &maxDamage, uint8 damageIndex=0)=0

References BASE_ATTACK, CalculateMinMaxDamage(), Object::GetFloatValue(), MAX_ITEM_PROTO_DAMAGES, OFF_ATTACK, RANGED_ATTACK, UNIT_FIELD_MAXDAMAGE, UNIT_FIELD_MAXOFFHANDDAMAGE, UNIT_FIELD_MAXRANGEDDAMAGE, UNIT_FIELD_MINDAMAGE, UNIT_FIELD_MINOFFHANDDAMAGE, UNIT_FIELD_MINRANGEDDAMAGE, and urand().

Referenced by CalculateMeleeDamage(), and Spell::EffectWeaponDmg().

◆ CalculateDefaultCoefficient()

float Unit::CalculateDefaultCoefficient ( SpellInfo const *  spellInfo,
DamageEffectType  damagetype 
) const
13711{
13712 // Damage over Time spells bonus calculation
13713 float DotFactor = 1.0f;
13714 if (damagetype == DOT)
13715 {
13716 int32 DotDuration = spellInfo->GetDuration();
13717 if (!spellInfo->IsChanneled() && DotDuration > 0)
13718 DotFactor = DotDuration / 15000.0f;
13719
13720 if (uint32 DotTicks = spellInfo->GetMaxTicks())
13721 DotFactor /= DotTicks;
13722 }
13723
13724 int32 CastingTime = spellInfo->IsChanneled() ? spellInfo->GetDuration() : spellInfo->CalcCastTime();
13725 // Distribute Damage over multiple effects, reduce by AoE
13726 CastingTime = GetCastingTimeForBonus(spellInfo, damagetype, CastingTime);
13727
13728 // As wowwiki says: C = (Cast Time / 3.5)
13729 return (CastingTime / 3500.0f) * DotFactor;
13730}
@ DOT
Definition Unit.h:257
uint32 GetCastingTimeForBonus(SpellInfo const *spellProto, DamageEffectType damagetype, uint32 CastingTime) const
Definition Unit.cpp:13592

References SpellInfo::CalcCastTime(), DOT, GetCastingTimeForBonus(), SpellInfo::GetDuration(), SpellInfo::GetMaxTicks(), and SpellInfo::IsChanneled().

Referenced by SpellDamageBonusTaken(), and SpellHealingBonusTaken().

◆ CalculateLevelPenalty()

float Unit::CalculateLevelPenalty ( SpellInfo const *  spellProto) const
3171{
3172 if (!IsPlayer())
3173 return 1.0f;
3174
3175 if (spellProto->SpellLevel <= 0 || spellProto->SpellLevel >= spellProto->MaxLevel)
3176 return 1.0f;
3177
3178 float LvlPenalty = 0.0f;
3179
3180 // xinef: added brackets
3181 if (spellProto->SpellLevel < 20)
3182 LvlPenalty = (20.0f - spellProto->SpellLevel) * 3.75f;
3183
3184 float LvlFactor = (float(spellProto->SpellLevel) + 6.0f) / float(GetLevel());
3185 if (LvlFactor > 1.0f)
3186 LvlFactor = 1.0f;
3187
3188 return AddPct(LvlFactor, -LvlPenalty);
3189}
uint8 GetLevel() const
Definition Unit.h:1092

References AddPct(), GetLevel(), Object::IsPlayer(), SpellInfo::MaxLevel, and SpellInfo::SpellLevel.

Referenced by spell_mage_ice_barrier_aura::CalculateSpellAmount(), spell_mage_ice_barrier::CalculateSpellAmount(), CalculateSpellAmount(), SpellDamageBonusDone(), SpellDamageBonusTaken(), SpellHealingBonusDone(), and SpellHealingBonusTaken().

◆ CalculateMeleeDamage()

void Unit::CalculateMeleeDamage ( Unit victim,
CalcDamageInfo damageInfo,
WeaponAttackType  attackType = BASE_ATTACK,
const bool  sittingVictim = false 
)
1605{
1606 damageInfo->attacker = this;
1607 damageInfo->target = victim;
1608
1609 for (uint8 i = 0; i < MAX_ITEM_PROTO_DAMAGES; ++i)
1610 {
1611 damageInfo->damages[i].damageSchoolMask = GetMeleeDamageSchoolMask(attackType, i);
1612 damageInfo->damages[i].damage = 0;
1613 damageInfo->damages[i].absorb = 0;
1614 damageInfo->damages[i].resist = 0;
1615 }
1616
1617 damageInfo->attackType = attackType;
1618 damageInfo->cleanDamage = 0;
1619 damageInfo->blocked_amount = 0;
1620
1621 damageInfo->TargetState = 0;
1622 damageInfo->HitInfo = 0;
1623 damageInfo->procAttacker = PROC_FLAG_NONE;
1624 damageInfo->procVictim = PROC_FLAG_NONE;
1625 damageInfo->hitOutCome = MELEE_HIT_EVADE;
1626
1627 if (!victim)
1628 return;
1629
1630 if (!IsAlive() || !victim->IsAlive())
1631 return;
1632
1633 // Select HitInfo/procAttacker/procVictim flag based on attack type
1634 switch (attackType)
1635 {
1636 case BASE_ATTACK:
1639 break;
1640 case OFF_ATTACK:
1643 damageInfo->HitInfo = HITINFO_OFFHAND;
1644 break;
1645 default:
1646 return;
1647 }
1648
1649 // School Immune check
1650 uint8 immunedMask = 0;
1651 bool hasNonPhysicalSchoolMask = false;
1652 for (uint8 i = 0; i < MAX_ITEM_PROTO_DAMAGES; ++i)
1653 {
1655 {
1656 immunedMask |= (1 << i);
1658 {
1659 hasNonPhysicalSchoolMask = true;
1660 }
1661 }
1662 }
1663
1664 // School Immune check
1665 if (immunedMask & ((1 << 0) | (1 << 1)))
1666 {
1667 if (hasNonPhysicalSchoolMask || immunedMask == ((1 << 0) | (1 << 1)))
1668 {
1669 damageInfo->HitInfo |= HITINFO_NORMALSWING;
1670 damageInfo->TargetState = VICTIMSTATE_IS_IMMUNE;
1671 return;
1672 }
1673 }
1674
1675 for (uint8 i = 0; i < MAX_ITEM_PROTO_DAMAGES; ++i)
1676 {
1677 // only players have secondary weapon damage
1678 if (i > 0 && !IsPlayer())
1679 {
1680 break;
1681 }
1682
1683 if (immunedMask & (1 << i))
1684 {
1685 continue;
1686 }
1687
1688 SpellSchoolMask schoolMask = SpellSchoolMask(damageInfo->damages[i].damageSchoolMask);
1689 bool const addPctMods = (schoolMask & SPELL_SCHOOL_MASK_NORMAL);
1690
1691 uint32 damage = 0;
1692 uint8 itemDamagesMask = (IsPlayer()) ? (1 << i) : 0;
1693
1694 damage += CalculateDamage(damageInfo->attackType, false, addPctMods, itemDamagesMask);
1695 // Add melee damage bonus
1696 damage = MeleeDamageBonusDone(damageInfo->target, damage, damageInfo->attackType, nullptr, schoolMask);
1697 damage = damageInfo->target->MeleeDamageBonusTaken(this, damage, damageInfo->attackType, nullptr, schoolMask);
1698
1699 // Script Hook For CalculateMeleeDamage -- Allow scripts to change the Damage pre class mitigation calculations
1700 sScriptMgr->ModifyMeleeDamage(damageInfo->target, damageInfo->attacker, damage);
1701
1702 if (victim->GetAI())
1703 {
1704 victim->GetAI()->OnCalculateMeleeDamageReceived(damage, this);
1705 }
1706
1707 // Calculate armor reduction
1709 {
1710 damageInfo->damages[i].damage = Unit::CalcArmorReducedDamage(this, damageInfo->target, damage, nullptr, 0, damageInfo->attackType);
1711 damageInfo->cleanDamage += damage - damageInfo->damages[i].damage;
1712 }
1713 else
1714 {
1715 damageInfo->damages[i].damage = damage;
1716 }
1717 }
1718
1719 damageInfo->hitOutCome = RollMeleeOutcomeAgainst(damageInfo->target, damageInfo->attackType);
1720
1721 // If the victim was a sitting player and we didn't roll a miss, then crit.
1722 if (sittingVictim && damageInfo->hitOutCome != MELEE_HIT_MISS)
1723 {
1724 damageInfo->hitOutCome = MELEE_HIT_CRIT;
1725 }
1726 switch (damageInfo->hitOutCome)
1727 {
1728 case MELEE_HIT_EVADE:
1730 damageInfo->TargetState = VICTIMSTATE_EVADES;
1731
1732 for (uint8 i = 0; i < MAX_ITEM_PROTO_DAMAGES; ++i)
1733 {
1734 damageInfo->damages[i].damage = 0;
1735 }
1736
1737 damageInfo->cleanDamage = 0;
1738 return;
1739 case MELEE_HIT_MISS:
1740 damageInfo->HitInfo |= HITINFO_MISS;
1741 damageInfo->TargetState = VICTIMSTATE_INTACT;
1742
1743 for (uint8 i = 0; i < MAX_ITEM_PROTO_DAMAGES; ++i)
1744 {
1745 damageInfo->damages[i].damage = 0;
1746 }
1747 damageInfo->cleanDamage = 0;
1748 break;
1749 case MELEE_HIT_NORMAL:
1750 damageInfo->TargetState = VICTIMSTATE_HIT;
1751 break;
1752 case MELEE_HIT_CRIT:
1753 {
1754 damageInfo->HitInfo |= HITINFO_CRITICALHIT;
1755 damageInfo->TargetState = VICTIMSTATE_HIT;
1756 // Crit bonus calc
1757 for (uint8 i = 0; i < MAX_ITEM_PROTO_DAMAGES; ++i)
1758 {
1759 damageInfo->damages[i].damage *= 2;
1760
1761 float mod = 0.0f;
1762 // Apply SPELL_AURA_MOD_ATTACKER_RANGED_CRIT_DAMAGE or SPELL_AURA_MOD_ATTACKER_MELEE_CRIT_DAMAGE
1763 if (damageInfo->attackType == RANGED_ATTACK)
1764 {
1766 }
1767 else
1768 {
1770
1771 // Increase crit damage from SPELL_AURA_MOD_CRIT_DAMAGE_BONUS
1773 }
1774
1775 uint32 crTypeMask = damageInfo->target->GetCreatureTypeMask();
1776
1777 // Increase crit damage from SPELL_AURA_MOD_CRIT_PERCENT_VERSUS
1779 if (mod != 0)
1780 {
1781 AddPct(damageInfo->damages[i].damage, mod);
1782 }
1783 }
1784 break;
1785 }
1786 case MELEE_HIT_PARRY:
1787 damageInfo->TargetState = VICTIMSTATE_PARRY;
1788 damageInfo->cleanDamage = 0;
1789
1790 for (uint8 i = 0; i < MAX_ITEM_PROTO_DAMAGES; ++i)
1791 {
1792 damageInfo->cleanDamage += damageInfo->damages[i].damage;
1793 damageInfo->damages[i].damage = 0;
1794 }
1795 break;
1796 case MELEE_HIT_DODGE:
1797 damageInfo->TargetState = VICTIMSTATE_DODGE;
1798 damageInfo->cleanDamage = 0;
1799
1800 for (uint8 i = 0; i < MAX_ITEM_PROTO_DAMAGES; ++i)
1801 {
1802 damageInfo->cleanDamage += damageInfo->damages[i].damage;
1803 damageInfo->damages[i].damage = 0;
1804 }
1805 break;
1806 case MELEE_HIT_BLOCK:
1807 {
1808 damageInfo->TargetState = VICTIMSTATE_HIT;
1809 damageInfo->HitInfo |= HITINFO_BLOCK;
1810 damageInfo->blocked_amount = damageInfo->target->GetShieldBlockValue();
1811 // double blocked amount if block is critical
1812 if (damageInfo->target->isBlockCritical())
1813 damageInfo->blocked_amount += damageInfo->blocked_amount;
1814
1815 uint32 remainingBlock = damageInfo->blocked_amount;
1816 uint8 fullBlockMask = 0;
1817 for (uint8 i = 0; i < MAX_ITEM_PROTO_DAMAGES; ++i)
1818 {
1819 if (remainingBlock && remainingBlock >= damageInfo->damages[i].damage)
1820 {
1821 fullBlockMask |= (1 << i);
1822
1823 remainingBlock -= damageInfo->damages[i].damage;
1824 damageInfo->cleanDamage += damageInfo->damages[i].damage;
1825 damageInfo->damages[i].damage = 0;
1826 }
1827 else
1828 {
1829 damageInfo->cleanDamage += remainingBlock;
1830 damageInfo->damages[i].damage -= remainingBlock;
1831 remainingBlock = 0;
1832 }
1833 }
1834
1835 // full block
1836 if (fullBlockMask == ((1 << 0) | (1 << 1)))
1837 {
1838 damageInfo->TargetState = VICTIMSTATE_BLOCKS;
1839 damageInfo->blocked_amount -= remainingBlock;
1840 }
1841 break;
1842 }
1843 case MELEE_HIT_GLANCING:
1844 {
1845 damageInfo->HitInfo |= HITINFO_GLANCING;
1846 damageInfo->TargetState = VICTIMSTATE_HIT;
1847 int32 leveldif = int32(victim->GetLevel()) - int32(GetLevel());
1848 if (leveldif > 3)
1849 leveldif = 3;
1850 float reducePercent = 1 - leveldif * 0.1f;
1851
1852 for (uint8 i = 0; i < MAX_ITEM_PROTO_DAMAGES; ++i)
1853 {
1854 uint32 reducedDamage = uint32(reducePercent * damageInfo->damages[i].damage);
1855 damageInfo->cleanDamage += damageInfo->damages[i].damage - reducedDamage;
1856 damageInfo->damages[i].damage = reducedDamage;
1857 }
1858 break;
1859 }
1860 case MELEE_HIT_CRUSHING:
1861 damageInfo->HitInfo |= HITINFO_CRUSHING;
1862 damageInfo->TargetState = VICTIMSTATE_HIT;
1863
1864 // 150% normal damage
1865 for (uint8 i = 0; i < MAX_ITEM_PROTO_DAMAGES; ++i)
1866 {
1867 damageInfo->damages[i].damage += (damageInfo->damages[i].damage / 2);
1868 }
1869 break;
1870 default:
1871 break;
1872 }
1873
1874 // Always apply HITINFO_AFFECTS_VICTIM in case its not a miss
1875 if (!(damageInfo->HitInfo & HITINFO_MISS))
1876 damageInfo->HitInfo |= HITINFO_AFFECTS_VICTIM;
1877
1878 uint32 tmpHitInfo[MAX_ITEM_PROTO_DAMAGES] = { };
1879
1880 for (uint8 i = 0; i < MAX_ITEM_PROTO_DAMAGES; ++i)
1881 {
1882 int32 dmg = damageInfo->damages[i].damage;
1883 int32 cleanDamage = damageInfo->cleanDamage;
1884 // attackType is checked already for BASE_ATTACK or OFF_ATTACK so it can't be RANGED_ATTACK here
1885 if (CanApplyResilience())
1886 {
1887 int32 resilienceReduction = damageInfo->damages[i].damage;
1888 Unit::ApplyResilience(victim, nullptr, &resilienceReduction, (damageInfo->hitOutCome == MELEE_HIT_CRIT), CR_CRIT_TAKEN_MELEE);
1889
1890 resilienceReduction = damageInfo->damages[i].damage - resilienceReduction;
1891 dmg -= resilienceReduction;
1892 cleanDamage += resilienceReduction;
1893 }
1894
1895 damageInfo->damages[i].damage = std::max(0, dmg);
1896 damageInfo->cleanDamage = std::max(0, cleanDamage);
1897
1898 // Calculate absorb resist
1899 if (damageInfo->damages[i].damage > 0)
1900 {
1901 damageInfo->procVictim |= PROC_FLAG_TAKEN_DAMAGE;
1902
1903 // Calculate absorb & resists
1904 DamageInfo dmgInfo(*damageInfo, i);
1905 Unit::CalcAbsorbResist(dmgInfo);
1906 damageInfo->damages[i].absorb = dmgInfo.GetAbsorb();
1907 damageInfo->damages[i].resist = dmgInfo.GetResist();
1908
1909 if (damageInfo->damages[i].absorb)
1910 {
1911 tmpHitInfo[i] |= (damageInfo->damages[i].damage - damageInfo->damages[i].absorb == 0 ? HITINFO_FULL_ABSORB : HITINFO_PARTIAL_ABSORB);
1912 }
1913
1914 if (damageInfo->damages[i].resist)
1915 {
1916 tmpHitInfo[i] |= (damageInfo->damages[i].damage - damageInfo->damages[i].resist == 0 ? HITINFO_FULL_RESIST : HITINFO_PARTIAL_RESIST);
1917 }
1918
1919 damageInfo->damages[i].damage = dmgInfo.GetDamage();
1920 }
1921 }
1922
1923 // set proper HitInfo flags
1924 if ((tmpHitInfo[0] & HITINFO_FULL_ABSORB) != 0)
1925 {
1926 // set partial absorb when secondary damage isn't full absorbed
1927 damageInfo->HitInfo |= ((tmpHitInfo[1] & HITINFO_PARTIAL_ABSORB) != 0) ? HITINFO_PARTIAL_ABSORB : HITINFO_FULL_ABSORB;
1928 }
1929 else
1930 {
1931 damageInfo->HitInfo |= (tmpHitInfo[0] & HITINFO_PARTIAL_ABSORB);
1932 }
1933
1934 if ((tmpHitInfo[0] & HITINFO_FULL_RESIST) != 0)
1935 {
1936 // set partial resist when secondary damage isn't full resisted
1937 damageInfo->HitInfo |= ((tmpHitInfo[1] & HITINFO_PARTIAL_RESIST) != 0) ? HITINFO_PARTIAL_RESIST : HITINFO_FULL_RESIST;
1938 }
1939 else
1940 {
1941 damageInfo->HitInfo |= (tmpHitInfo[0] & HITINFO_PARTIAL_RESIST);
1942 }
1943
1944}
@ SPELL_AURA_MOD_CRIT_PERCENT_VERSUS
Definition SpellAuraDefines.h:232
@ SPELL_AURA_MOD_ATTACKER_RANGED_CRIT_DAMAGE
Definition SpellAuraDefines.h:267
@ SPELL_AURA_MOD_CRIT_DAMAGE_BONUS
Definition SpellAuraDefines.h:226
@ SPELL_AURA_MOD_ATTACKER_MELEE_CRIT_DAMAGE
Definition SpellAuraDefines.h:266
@ PROC_FLAG_DONE_MELEE_AUTO_ATTACK
Definition SpellMgr.h:110
@ PROC_FLAG_DONE_MAINHAND_ATTACK
Definition SpellMgr.h:140
@ PROC_FLAG_TAKEN_DAMAGE
Definition SpellMgr.h:137
@ PROC_FLAG_TAKEN_MELEE_AUTO_ATTACK
Definition SpellMgr.h:111
@ PROC_FLAG_DONE_OFFHAND_ATTACK
Definition SpellMgr.h:141
@ PROC_FLAG_NONE
Definition SpellMgr.h:105
@ VICTIMSTATE_INTACT
Definition Unit.h:85
@ VICTIMSTATE_HIT
Definition Unit.h:86
@ VICTIMSTATE_DODGE
Definition Unit.h:87
@ VICTIMSTATE_IS_IMMUNE
Definition Unit.h:92
@ VICTIMSTATE_PARRY
Definition Unit.h:88
@ VICTIMSTATE_BLOCKS
Definition Unit.h:90
@ VICTIMSTATE_EVADES
Definition Unit.h:91
@ HITINFO_PARTIAL_ABSORB
Definition Unit.h:105
@ HITINFO_FULL_RESIST
Definition Unit.h:106
@ HITINFO_NORMALSWING
Definition Unit.h:98
@ HITINFO_BLOCK
Definition Unit.h:112
@ HITINFO_CRUSHING
Definition Unit.h:116
@ HITINFO_SWINGNOHITSOUND
Definition Unit.h:120
@ HITINFO_MISS
Definition Unit.h:103
@ HITINFO_FULL_ABSORB
Definition Unit.h:104
@ HITINFO_OFFHAND
Definition Unit.h:101
@ HITINFO_GLANCING
Definition Unit.h:115
@ HITINFO_CRITICALHIT
Definition Unit.h:108
@ HITINFO_PARTIAL_RESIST
Definition Unit.h:107
@ HITINFO_AFFECTS_VICTIM
Definition Unit.h:100
@ MELEE_HIT_CRUSHING
Definition Unit.h:293
@ MELEE_HIT_BLOCK
Definition Unit.h:292
@ MELEE_HIT_CRIT
Definition Unit.h:293
@ MELEE_HIT_EVADE
Definition Unit.h:292
@ MELEE_HIT_DODGE
Definition Unit.h:292
@ MELEE_HIT_MISS
Definition Unit.h:292
@ MELEE_HIT_PARRY
Definition Unit.h:292
@ MELEE_HIT_GLANCING
Definition Unit.h:293
virtual void OnCalculateMeleeDamageReceived(uint32 &, Unit *)
Called during damage calculations.
Definition UnitAI.h:380
bool isBlockCritical()
Definition Unit.cpp:3256
uint32 MeleeDamageBonusTaken(Unit *attacker, uint32 pdamage, WeaponAttackType attType, SpellInfo const *spellProto=nullptr, SpellSchoolMask damageSchoolMask=SPELL_SCHOOL_MASK_NORMAL)
Definition Unit.cpp:10205
virtual SpellSchoolMask GetMeleeDamageSchoolMask(WeaponAttackType attackType=BASE_ATTACK, uint8 damageIndex=0) const =0
int32 GetTotalAuraModifierByMiscMask(AuraType auratype, uint32 misc_mask) const
Definition Unit.cpp:6252
bool CanApplyResilience() const
Definition Unit.h:1160
uint32 CalculateDamage(WeaponAttackType attType, bool normalized, bool addTotalPct, uint8 itemDamagesMask=0)
Definition Unit.cpp:3114
virtual uint32 GetShieldBlockValue() const =0
static void ApplyResilience(Unit const *victim, float *crit, int32 *damage, bool isCrit, CombatRating type)
Definition Unit.cpp:15293
UnitAI * GetAI()
Definition Unit.h:687
static bool IsDamageReducedByArmor(SpellSchoolMask damageSchoolMask, SpellInfo const *spellInfo=nullptr, uint8 effIndex=MAX_SPELL_EFFECTS)
Definition Unit.cpp:2132
int32 GetTotalAuraModifier(AuraType auratype) const
Definition Unit.cpp:6232
MeleeHitOutcome RollMeleeOutcomeAgainst(Unit const *victim, WeaponAttackType attType) const
Definition Unit.cpp:2913
uint32 GetCreatureTypeMask() const
Definition Unit.h:822
uint32 MeleeDamageBonusDone(Unit *pVictim, uint32 damage, WeaponAttackType attType, SpellInfo const *spellProto=nullptr, SpellSchoolMask damageSchoolMask=SPELL_SCHOOL_MASK_NORMAL)
Definition Unit.cpp:10015
uint32 damageSchoolMask
Definition Unit.h:483
uint32 blocked_amount
Definition Unit.h:489
MeleeHitOutcome hitOutCome
Definition Unit.h:497
uint32 cleanDamage
Definition Unit.h:496
uint32 TargetState
Definition Unit.h:491
uint32 resist
Definition Unit.h:486

References CalcDamageInfo::absorb, AddPct(), ApplyResilience(), CalcDamageInfo::attacker, CalcDamageInfo::attackType, BASE_ATTACK, CalcDamageInfo::blocked_amount, CalcAbsorbResist(), CalcArmorReducedDamage(), CalculateDamage(), CanApplyResilience(), CalcDamageInfo::cleanDamage, CR_CRIT_TAKEN_MELEE, CalcDamageInfo::damage, CalcDamageInfo::damages, CalcDamageInfo::damageSchoolMask, DamageInfo::GetAbsorb(), GetAI(), GetCreatureTypeMask(), DamageInfo::GetDamage(), GetLevel(), GetMeleeDamageSchoolMask(), DamageInfo::GetResist(), GetShieldBlockValue(), GetTotalAuraModifier(), GetTotalAuraModifierByMiscMask(), GetTotalAuraMultiplierByMiscMask(), CalcDamageInfo::HitInfo, HITINFO_AFFECTS_VICTIM, HITINFO_BLOCK, HITINFO_CRITICALHIT, HITINFO_CRUSHING, HITINFO_FULL_ABSORB, HITINFO_FULL_RESIST, HITINFO_GLANCING, HITINFO_MISS, HITINFO_NORMALSWING, HITINFO_OFFHAND, HITINFO_PARTIAL_ABSORB, HITINFO_PARTIAL_RESIST, HITINFO_SWINGNOHITSOUND, CalcDamageInfo::hitOutCome, IsAlive(), isBlockCritical(), IsDamageReducedByArmor(), IsImmunedToDamageOrSchool(), Object::IsPlayer(), MAX_ITEM_PROTO_DAMAGES, MELEE_HIT_BLOCK, MELEE_HIT_CRIT, MELEE_HIT_CRUSHING, MELEE_HIT_DODGE, MELEE_HIT_EVADE, MELEE_HIT_GLANCING, MELEE_HIT_MISS, MELEE_HIT_NORMAL, MELEE_HIT_PARRY, MeleeDamageBonusDone(), MeleeDamageBonusTaken(), OFF_ATTACK, UnitAI::OnCalculateMeleeDamageReceived(), PROC_FLAG_DONE_MAINHAND_ATTACK, PROC_FLAG_DONE_MELEE_AUTO_ATTACK, PROC_FLAG_DONE_OFFHAND_ATTACK, PROC_FLAG_NONE, PROC_FLAG_TAKEN_DAMAGE, PROC_FLAG_TAKEN_MELEE_AUTO_ATTACK, CalcDamageInfo::procAttacker, CalcDamageInfo::procVictim, RANGED_ATTACK, CalcDamageInfo::resist, RollMeleeOutcomeAgainst(), SPELL_AURA_MOD_ATTACKER_MELEE_CRIT_DAMAGE, SPELL_AURA_MOD_ATTACKER_RANGED_CRIT_DAMAGE, SPELL_AURA_MOD_CRIT_DAMAGE_BONUS, SPELL_AURA_MOD_CRIT_PERCENT_VERSUS, SPELL_SCHOOL_MASK_NORMAL, sScriptMgr, CalcDamageInfo::target, CalcDamageInfo::TargetState, VICTIMSTATE_BLOCKS, VICTIMSTATE_DODGE, VICTIMSTATE_EVADES, VICTIMSTATE_HIT, VICTIMSTATE_INTACT, VICTIMSTATE_IS_IMMUNE, and VICTIMSTATE_PARRY.

Referenced by AttackerStateUpdate(), and spell_dk_dancing_rune_weapon::HandleProc().

◆ CalculateMinMaxDamage()

virtual void Unit::CalculateMinMaxDamage ( WeaponAttackType  attType,
bool  normalized,
bool  addTotalPct,
float &  minDamage,
float &  maxDamage,
uint8  damageIndex = 0 
)
pure virtual

Implemented in Creature, and Player.

Referenced by CalculateDamage(), and UpdateDamagePhysical().

◆ CalculateSpellDamage()

int32 Unit::CalculateSpellDamage ( Unit const *  target,
SpellInfo const *  spellProto,
uint8  effect_index,
int32 const *  basePoints = nullptr 
) const

◆ CalculateSpellDamageTaken()

void Unit::CalculateSpellDamageTaken ( SpellNonMeleeDamage damageInfo,
int32  damage,
SpellInfo const *  spellInfo,
WeaponAttackType  attackType = BASE_ATTACK,
bool  crit = false 
)
1436{
1437 if (damage < 0)
1438 return;
1439
1440 Unit* victim = damageInfo->target;
1441 if (!victim || !victim->IsAlive())
1442 return;
1443
1444 SpellSchoolMask damageSchoolMask = SpellSchoolMask(damageInfo->schoolMask);
1445 uint32 crTypeMask = victim->GetCreatureTypeMask();
1446
1447 // Script Hook For CalculateSpellDamageTaken -- Allow scripts to change the Damage post class mitigation calculations
1448 sScriptMgr->ModifySpellDamageTaken(damageInfo->target, damageInfo->attacker, damage, spellInfo);
1449
1450 if (victim->GetAI())
1451 {
1452 victim->GetAI()->OnCalculateSpellDamageReceived(damage, this);
1453 }
1454
1455 int32 cleanDamage = 0;
1456 if (!spellInfo->HasAttribute(SPELL_ATTR4_IGNORE_DAMAGE_TAKEN_MODIFIERS) && Unit::IsDamageReducedByArmor(damageSchoolMask, spellInfo))
1457 {
1458 int32 oldDamage = damage;
1459 damage = Unit::CalcArmorReducedDamage(this, victim, damage, spellInfo, 0, attackType);
1460 cleanDamage = oldDamage - damage;
1461 }
1462
1463 bool blocked = false;
1464 // Per-school calc
1465 switch (spellInfo->DmgClass)
1466 {
1467 // Melee and Ranged Spells
1470 {
1471 // Physical Damage
1472 if (damageSchoolMask & SPELL_SCHOOL_MASK_NORMAL)
1473 {
1474 // Get blocked status
1475 blocked = isSpellBlocked(victim, spellInfo, attackType);
1476 }
1477
1478 if (crit)
1479 {
1480 damageInfo->HitInfo |= SPELL_HIT_TYPE_CRIT;
1481
1482 // Calculate crit bonus
1483 uint32 crit_bonus = damage;
1484 // Apply crit_damage bonus for melee spells
1485 if (Player* modOwner = GetSpellModOwner())
1486 modOwner->ApplySpellMod(spellInfo->Id, SPELLMOD_CRIT_DAMAGE_BONUS, crit_bonus);
1487 damage += crit_bonus;
1488
1489 // Apply SPELL_AURA_MOD_ATTACKER_RANGED_CRIT_DAMAGE or SPELL_AURA_MOD_ATTACKER_MELEE_CRIT_DAMAGE
1490 float critPctDamageMod = 0.0f;
1491 if (attackType == RANGED_ATTACK)
1493 else
1495
1496 // Increase crit damage from SPELL_AURA_MOD_CRIT_DAMAGE_BONUS
1497 critPctDamageMod += GetTotalAuraModifierByMiscMask(SPELL_AURA_MOD_CRIT_DAMAGE_BONUS, spellInfo->GetSchoolMask());
1498
1499 // Increase crit damage from SPELL_AURA_MOD_CRIT_PERCENT_VERSUS
1501
1502 if (critPctDamageMod != 0)
1503 AddPct(damage, critPctDamageMod);
1504 }
1505
1506 // Spell weapon based damage CAN BE crit & blocked at same time
1507 if (blocked)
1508 {
1509 damageInfo->blocked = victim->GetShieldBlockValue();
1510 // double blocked amount if block is critical
1511 if (victim->isBlockCritical())
1512 damageInfo->blocked *= 2;
1513 if (damage < int32(damageInfo->blocked))
1514 damageInfo->blocked = uint32(damage);
1515
1516 damage -= damageInfo->blocked;
1517 cleanDamage += damageInfo->blocked;
1518 }
1519
1520 int32 resilienceReduction = damage;
1521 if (CanApplyResilience())
1522 {
1523 if (attackType != RANGED_ATTACK)
1524 {
1525 Unit::ApplyResilience(victim, nullptr, &resilienceReduction, crit, CR_CRIT_TAKEN_MELEE);
1526 }
1527 else
1528 {
1529 Unit::ApplyResilience(victim, nullptr, &resilienceReduction, crit, CR_CRIT_TAKEN_RANGED);
1530 }
1531 }
1532
1533 resilienceReduction = damage - resilienceReduction;
1534 damage -= resilienceReduction;
1535 cleanDamage += resilienceReduction;
1536 break;
1537 }
1538 // Magical Attacks
1541 {
1542 // If crit add critical bonus
1543 if (crit)
1544 {
1545 damageInfo->HitInfo |= SPELL_HIT_TYPE_CRIT;
1546 damage = Unit::SpellCriticalDamageBonus(this, spellInfo, damage, victim);
1547 }
1548
1549 int32 resilienceReduction = damage;
1550 if (CanApplyResilience())
1551 {
1552 Unit::ApplyResilience(victim, nullptr, &resilienceReduction, crit, CR_CRIT_TAKEN_SPELL);
1553 }
1554
1555 resilienceReduction = damage - resilienceReduction;
1556 damage -= resilienceReduction;
1557 cleanDamage += resilienceReduction;
1558 break;
1559 }
1560 default:
1561 break;
1562 }
1563
1564 damageInfo->cleanDamage = std::max(0, cleanDamage);
1565 damageInfo->damage = std::max(0, damage);
1566
1567 // Calculate absorb resist
1568 if (damageInfo->damage > 0)
1569 {
1570 DamageInfo dmgInfo(*damageInfo, SPELL_DIRECT_DAMAGE, BASE_ATTACK, 0);
1571 Unit::CalcAbsorbResist(dmgInfo);
1572 damageInfo->absorb = dmgInfo.GetAbsorb();
1573 damageInfo->resist = dmgInfo.GetResist();
1574 damageInfo->damage = dmgInfo.GetDamage();
1575 }
1576}
@ SPELL_DAMAGE_CLASS_RANGED
Definition SharedDefines.h:1559
@ SPELL_DAMAGE_CLASS_MAGIC
Definition SharedDefines.h:1557
@ SPELL_DAMAGE_CLASS_NONE
Definition SharedDefines.h:1556
@ SPELL_DAMAGE_CLASS_MELEE
Definition SharedDefines.h:1558
@ SPELL_HIT_TYPE_CRIT
Definition SharedDefines.h:1547
@ SPELL_ATTR4_IGNORE_DAMAGE_TAKEN_MODIFIERS
Definition SharedDefines.h:549
@ SPELLMOD_CRIT_DAMAGE_BONUS
Definition SpellDefines.h:91
@ SPELL_DIRECT_DAMAGE
Definition Unit.h:256
virtual void OnCalculateSpellDamageReceived(int32 &, Unit *)
Definition UnitAI.h:381
bool isSpellBlocked(Unit *victim, SpellInfo const *spellProto, WeaponAttackType attackType=BASE_ATTACK)
Definition Unit.cpp:3230
static uint32 SpellCriticalDamageBonus(Unit const *caster, SpellInfo const *spellProto, uint32 damage, Unit const *victim)
Definition Unit.cpp:9243
Unit * target
Definition Unit.h:508
uint32 HitInfo
Definition Unit.h:519
uint32 damage
Definition Unit.h:511
uint32 absorb
Definition Unit.h:514
Unit * attacker
Definition Unit.h:509
uint32 schoolMask
Definition Unit.h:513
uint32 cleanDamage
Definition Unit.h:521
uint32 resist
Definition Unit.h:515
uint32 blocked
Definition Unit.h:518

References SpellNonMeleeDamage::absorb, AddPct(), ApplyResilience(), SpellNonMeleeDamage::attacker, BASE_ATTACK, SpellNonMeleeDamage::blocked, CalcAbsorbResist(), CalcArmorReducedDamage(), CanApplyResilience(), SpellNonMeleeDamage::cleanDamage, CR_CRIT_TAKEN_MELEE, CR_CRIT_TAKEN_RANGED, CR_CRIT_TAKEN_SPELL, SpellNonMeleeDamage::damage, SpellInfo::DmgClass, DamageInfo::GetAbsorb(), GetAI(), GetCreatureTypeMask(), DamageInfo::GetDamage(), DamageInfo::GetResist(), SpellInfo::GetSchoolMask(), GetShieldBlockValue(), GetSpellModOwner(), GetTotalAuraModifier(), GetTotalAuraModifierByMiscMask(), SpellInfo::HasAttribute(), SpellNonMeleeDamage::HitInfo, SpellInfo::Id, IsAlive(), isBlockCritical(), IsDamageReducedByArmor(), isSpellBlocked(), UnitAI::OnCalculateSpellDamageReceived(), RANGED_ATTACK, SpellNonMeleeDamage::resist, SpellNonMeleeDamage::schoolMask, SPELL_ATTR4_IGNORE_DAMAGE_TAKEN_MODIFIERS, SPELL_AURA_MOD_ATTACKER_MELEE_CRIT_DAMAGE, SPELL_AURA_MOD_ATTACKER_RANGED_CRIT_DAMAGE, SPELL_AURA_MOD_CRIT_DAMAGE_BONUS, SPELL_AURA_MOD_CRIT_PERCENT_VERSUS, SPELL_DAMAGE_CLASS_MAGIC, SPELL_DAMAGE_CLASS_MELEE, SPELL_DAMAGE_CLASS_NONE, SPELL_DAMAGE_CLASS_RANGED, SPELL_DIRECT_DAMAGE, SPELL_HIT_TYPE_CRIT, SPELL_SCHOOL_MASK_NORMAL, SpellCriticalDamageBonus(), SPELLMOD_CRIT_DAMAGE_BONUS, sScriptMgr, and SpellNonMeleeDamage::target.

Referenced by Spell::DoAllEffectOnTarget(), AuraEffect::HandlePeriodicPowerBurnAuraTick(), and AuraEffect::HandleProcTriggerDamageAuraProc().

◆ CanApplyResilience()

bool Unit::CanApplyResilience ( ) const
inline

◆ CanDualWield()

◆ CanEnterWater()

virtual bool Unit::CanEnterWater ( ) const
pure virtual

Implemented in Creature, and Player.

◆ CanFly()

◆ CanFreeMove()

bool Unit::CanFreeMove ( ) const
inline
1708 {
1711 }
@ UNIT_STATE_DISTRACTED
Definition UnitDefines.h:182
@ UNIT_STATE_CONFUSED
Definition UnitDefines.h:181
@ UNIT_STATE_FLEEING
Definition UnitDefines.h:177
@ UNIT_STATE_IN_FLIGHT
Definition UnitDefines.h:178
@ UNIT_STATE_STUNNED
Definition UnitDefines.h:173

References GetOwnerGUID(), HasUnitState(), UNIT_STATE_CONFUSED, UNIT_STATE_DISTRACTED, UNIT_STATE_FLEEING, UNIT_STATE_IN_FLIGHT, UNIT_STATE_ROOT, and UNIT_STATE_STUNNED.

Referenced by Creature::IsFreeToMove().

◆ CanHaveThreatList()

bool Unit::CanHaveThreatList ( bool  skipAliveCheck = false) const
11495{
11496 // only creatures can have threat list
11497 if (!IsCreature())
11498 return false;
11499
11500 // only alive units can have threat list
11501 if (!skipAliveCheck && !IsAlive())
11502 return false;
11503
11504 // totems can not have threat list
11505 if (ToCreature()->IsTotem())
11506 return false;
11507
11508 // vehicles can not have threat list
11509 if (ToCreature()->IsVehicle() && GetMap()->IsBattlegroundOrArena())
11510 return false;
11511
11512 // summons can not have a threat list, unless they are controlled by a creature
11514 return false;
11515
11516 return true;
11517}
@ UNIT_MASK_CONTROLLABLE_GUARDIAN
Definition UnitDefines.h:164
@ UNIT_MASK_GUARDIAN
Definition UnitDefines.h:158
bool IsVehicle() const
Definition Unit.h:794
Map * GetMap() const
Definition Object.h:620

References WorldObject::GetMap(), GetOwnerGUID(), HasUnitTypeMask(), IsAlive(), Object::IsCreature(), Object::IsPlayer(), IsTotem(), IsVehicle(), Object::ToCreature(), UNIT_MASK_CONTROLLABLE_GUARDIAN, UNIT_MASK_GUARDIAN, and UNIT_MASK_MINION.

Referenced by AddThreat(), Creature::CanPeriodicallyCallForAssistance(), ThreatMgr::ClearAllThreat(), DealDamage(), ScriptedAI::DoResetThreatList(), CreatureAI::DoZoneInCombat(), Spell::EffectTaunt(), Spell::EffectThreat(), AuraEffect::HandleAuraDummy(), AuraEffect::HandleModTaunt(), spell_pet_guard_dog::HandleProc(), Spell::HandleThreatSpells(), instance_icecrown_citadel::instance_icecrown_citadel_InstanceMapScript::OnCreatureCreate(), Creature::SelectVictim(), TauntApply(), TauntFadeOut(), and Update().

◆ CanInstantCast()

bool Unit::CanInstantCast ( ) const
inline
1576{ return _instantCast; }

References _instantCast.

Referenced by ModSpellCastTime().

◆ CanModifyStats()

◆ CanProc()

bool Unit::CanProc ( )
inline
1546{ return !m_procDeep; }

References m_procDeep.

Referenced by Spell::DoAllEffectOnTarget().

◆ CanRestoreMana()

bool Unit::CanRestoreMana ( SpellInfo const *  spellInfo) const
17444{
17445 // Aura of Despair exceptions
17446 switch (spellInfo->Id)
17447 {
17448 case 16666: // Demonic Rune
17449 case 27869: // Dark Rune
17450 case 30824: // Shamanistic Rage
17451 case 31786: // Spiritual Attunement
17452 case 31930: // Judgements of the Wise
17453 case 34075: // Aspect of the Viper
17454 case 34720: // Thrill of the hunt
17455 case 47755: // Rapture
17456 case 54425: // Improved Felhunter
17457 case 57319: // Blessing of Sanctuary
17458 case 63337: // Saronite Vapors (regenerate mana)
17459 case 63375: // Improved stormstrike
17460 case 64372: // Lifebloom
17461 case 68285: // Improved Leader of the Pack
17462 return true;
17463 case 54428: // Divine Plea - only with talent Guarded by the Light
17464 return HasSpell(53583);
17465 default:
17466 break;
17467 }
17468
17469 return false;
17470}
virtual bool HasSpell(uint32) const
Definition Unit.h:1571

References HasSpell(), and SpellInfo::Id.

Referenced by IsImmunedToSpellEffect().

◆ CanSparringWith()

bool Unit::CanSparringWith ( Unit const *  attacker) const
protected
4080{
4082 return false;
4083
4084 if (!attacker)
4085 return false;
4086
4087 if (!attacker->IsCreature() || attacker->IsCharmedOwnedByPlayerOrPlayer())
4088 return false;
4089
4090 if (Creature const* creature = ToCreature())
4091 if (!creature->GetSparringPct())
4092 return false;
4093
4094 return true;
4095}
bool IsCharmedOwnedByPlayerOrPlayer() const
Definition Unit.h:1298

References IsCharmedOwnedByPlayerOrPlayer(), Object::IsCreature(), and Object::ToCreature().

Referenced by AttackerStateUpdate(), and DealDamage().

◆ CanSwim()

bool Unit::CanSwim ( ) const
virtual

this method checks the current flag of a unit

These flags can be set within the database or dynamically changed at runtime UNIT_FLAG_SWIMMING must be updated when a unit enters a swimmable area

Reimplemented in Creature.

16060{
16061 // Mirror client behavior, if this method returns false then client will not use swimming animation and for players will apply gravity as if there was no water
16063 return false;
16065 return true;
16067 return false;
16069 return true;
16071}
@ UNIT_FLAG2_UNUSED_6
Definition UnitDefines.h:311
@ UNIT_FLAG_CANNOT_SWIM
Definition UnitDefines.h:268
@ UNIT_FLAG_POSSESSED
Definition UnitDefines.h:278
@ UNIT_FLAG_SWIMMING
Definition UnitDefines.h:269
@ UNIT_FLAG_RENAME
Definition UnitDefines.h:258
@ UNIT_FLAG_PET_IN_COMBAT
Definition UnitDefines.h:265
bool HasUnitFlag2(UnitFlags2 flags) const
Definition Unit.h:747

References HasUnitFlag(), HasUnitFlag2(), UNIT_FLAG2_UNUSED_6, UNIT_FLAG_CANNOT_SWIM, UNIT_FLAG_PET_IN_COMBAT, UNIT_FLAG_PLAYER_CONTROLLED, UNIT_FLAG_POSSESSED, UNIT_FLAG_RENAME, and UNIT_FLAG_SWIMMING.

Referenced by PathGenerator::BuildPolyPath(), and Creature::CanSwim().

◆ CanUseAttackType()

◆ CastCustomSpell() [1/5]

SpellCastResult Unit::CastCustomSpell ( SpellInfo const *  spellInfo,
CustomSpellValues const &  value,
Unit victim = nullptr,
TriggerCastFlags  triggerFlags = TRIGGERED_NONE,
Item castItem = nullptr,
AuraEffect const *  triggeredByAura = nullptr,
ObjectGuid  originalCaster = ObjectGuid::Empty 
)
1398{
1399 SpellCastTargets targets;
1400 targets.SetUnitTarget(victim);
1401
1402 return CastSpell(targets, spellInfo, &value, triggerFlags, castItem, triggeredByAura, originalCaster);
1403}
Definition Spell.h:119
void SetUnitTarget(Unit *target)
Definition Spell.cpp:238

References CastSpell(), and SpellCastTargets::SetUnitTarget().

◆ CastCustomSpell() [2/5]

SpellCastResult Unit::CastCustomSpell ( uint32  spellId,
CustomSpellValues const &  value,
Unit victim = nullptr,
TriggerCastFlags  triggerFlags = TRIGGERED_NONE,
Item castItem = nullptr,
AuraEffect const *  triggeredByAura = nullptr,
ObjectGuid  originalCaster = ObjectGuid::Empty 
)
1386{
1387 SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId);
1388 if (!spellInfo)
1389 {
1390 LOG_ERROR("entities.unit", "CastSpell: unknown spell {} by caster {}", spellId, GetGUID().ToString());
1392 }
1393
1394 return CastCustomSpell(spellInfo, value, victim, triggerFlags, castItem, triggeredByAura, originalCaster);
1395}
@ SPELL_FAILED_SPELL_UNAVAILABLE
Definition SharedDefines.h:1067
SpellCastResult CastCustomSpell(Unit *victim, uint32 spellId, int32 const *bp0, int32 const *bp1, int32 const *bp2, bool triggered, Item *castItem=nullptr, AuraEffect const *triggeredByAura=nullptr, ObjectGuid originalCaster=ObjectGuid::Empty)
Definition Unit.cpp:1359

References CastCustomSpell(), Object::GetGUID(), LOG_ERROR, SPELL_FAILED_SPELL_UNAVAILABLE, sSpellMgr, and Position::ToString().

◆ CastCustomSpell() [3/5]

SpellCastResult Unit::CastCustomSpell ( uint32  spellId,
SpellValueMod  mod,
int32  value,
Unit victim,
bool  triggered,
Item castItem = nullptr,
AuraEffect const *  triggeredByAura = nullptr,
ObjectGuid  originalCaster = ObjectGuid::Empty 
)
1372{
1373 CustomSpellValues values;
1374 values.AddSpellMod(mod, value);
1375 return CastCustomSpell(spellId, values, target, triggered ? TRIGGERED_FULL_MASK : TRIGGERED_NONE, castItem, triggeredByAura, originalCaster);
1376}
@ TRIGGERED_NONE
Definition SpellDefines.h:133
Definition SpellDefines.h:165
void AddSpellMod(SpellValueMod mod, int32 value)
Definition SpellDefines.h:167

References CustomSpellValues::AddSpellMod(), CastCustomSpell(), TRIGGERED_FULL_MASK, and TRIGGERED_NONE.

◆ CastCustomSpell() [4/5]

SpellCastResult Unit::CastCustomSpell ( uint32  spellId,
SpellValueMod  mod,
int32  value,
Unit victim = nullptr,
TriggerCastFlags  triggerFlags = TRIGGERED_NONE,
Item castItem = nullptr,
AuraEffect const *  triggeredByAura = nullptr,
ObjectGuid  originalCaster = ObjectGuid::Empty 
)
1379{
1380 CustomSpellValues values;
1381 values.AddSpellMod(mod, value);
1382 return CastCustomSpell(spellId, values, target, triggerFlags, castItem, triggeredByAura, originalCaster);
1383}

References CustomSpellValues::AddSpellMod(), and CastCustomSpell().

◆ CastCustomSpell() [5/5]

SpellCastResult Unit::CastCustomSpell ( Unit victim,
uint32  spellId,
int32 const *  bp0,
int32 const *  bp1,
int32 const *  bp2,
bool  triggered,
Item castItem = nullptr,
AuraEffect const *  triggeredByAura = nullptr,
ObjectGuid  originalCaster = ObjectGuid::Empty 
)
1360{
1361 CustomSpellValues values;
1362 if (bp0)
1363 values.AddSpellMod(SPELLVALUE_BASE_POINT0, *bp0);
1364 if (bp1)
1365 values.AddSpellMod(SPELLVALUE_BASE_POINT1, *bp1);
1366 if (bp2)
1367 values.AddSpellMod(SPELLVALUE_BASE_POINT2, *bp2);
1368 return CastCustomSpell(spellId, values, target, triggered ? TRIGGERED_FULL_MASK : TRIGGERED_NONE, castItem, triggeredByAura, originalCaster);
1369}
@ SPELLVALUE_BASE_POINT1
Definition SpellDefines.h:114
@ SPELLVALUE_BASE_POINT2
Definition SpellDefines.h:115
@ SPELLVALUE_BASE_POINT0
Definition SpellDefines.h:113

References CustomSpellValues::AddSpellMod(), CastCustomSpell(), SPELLVALUE_BASE_POINT0, SPELLVALUE_BASE_POINT1, SPELLVALUE_BASE_POINT2, TRIGGERED_FULL_MASK, and TRIGGERED_NONE.

Referenced by spell_pri_guardian_spirit::Absorb(), spell_mage_fire_frost_ward::Absorb(), spell_pal_ardent_defender::Absorb(), spell_dru_survival_instincts_aura::AfterApply(), spell_the_lich_king_necrotic_plague_jump_aura::AfterDispel(), spell_dru_lifebloom::AfterRemove(), Player::ApplyEnchantment(), CastCustomSpell(), CastCustomSpell(), CastCustomSpell(), CastCustomSpell(), CastDelayedSpellWithPeriodicAmount(), npc_gas_cloud::npc_gas_cloudAI::CastMainSpell(), CastPetAura(), spell_ruby_sanctum_rallying_shout::CountAllies(), spell_igb_rocket_artillery_explosion::DamageGunship(), boss_illidari_council_memberAI::DamageTaken(), boss_tenris_mirkblood::DamageTaken(), boss_leotheras_the_blind::DemonTime(), spell_warl_seed_of_corruption_generic_aura::Detonate(), boss_sister_svalna::boss_sister_svalnaAI::DoAction(), Spell::EffectDestroyAllTotems(), Spell::EffectDispel(), Spell::EffectFeedPet(), Spell::EffectForceCast(), Spell::EffectSchoolDMG(), Spell::EffectSummonType(), EnterVehicle(), EnterVehicleUnattackable(), AuraMunchingQueue::Execute(), TriggerWickedSpirit::Execute(), spell_sha_totem_of_wrath::HandleAfterCast(), spell_reflective_shield_aura::HandleAfterEffectAbsorb(), spell_dk_scourge_strike::HandleAfterHit(), spell_dru_enrage::HandleApply(), spell_pal_avenging_wrath::HandleApply(), AuraEffect::HandleAuraLinked(), AuraEffect::HandleAuraModShapeshift(), HandleAuraRaidProcFromChargeWithValue(), Aura::HandleAuraSpecificMods(), spell_pri_shadow_word_death::HandleDamage(), spell_dk_corpse_explosion::HandleDamage(), spell_dru_lifebloom::HandleDispel(), spell_igb_burning_pitch::HandleDummy(), spell_ahn_kahet_swarmer_aura::HandleDummy(), spell_deathbringer_blood_link::HandleDummy(), spell_dk_death_coil::HandleDummy(), spell_dk_death_strike::HandleDummy(), spell_gen_dummy_trigger::HandleDummy(), spell_hun_last_stand_pet::HandleDummy(), spell_item_deadly_precision_dummy::HandleDummy(), spell_pal_divine_storm_dummy::HandleDummy(), spell_sha_ancestral_awakening_proc::HandleDummy(), spell_sha_cleansing_totem_pulse::HandleDummy(), spell_warl_life_tap::HandleDummy(), spell_warr_last_stand::HandleDummy(), spell_warr_charge::HandleDummy(), spell_warr_slam::HandleDummy(), spell_warr_bloodthirst::HandleDummy(), spell_egg_explosion::HandleDummyHitTarget(), spell_warr_execute::HandleEffect(), spell_dk_improved_blood_presence::HandleEffectApply(), spell_dk_improved_frost_presence::HandleEffectApply(), spell_dk_improved_unholy_presence::HandleEffectApply(), spell_rog_prey_on_the_weak::HandleEffectPeriodic(), spell_serpentshrine_cavern_infection::HandleEffectRemove(), spell_dk_presence::HandleImprovedBloodPresence(), spell_dk_presence::HandleImprovedFrostPresence(), spell_dk_presence::HandleImprovedUnholyPresence(), spell_ragin_flames_inferno::HandlePeriodic(), spell_dk_death_and_decay_aura::HandlePeriodic(), spell_dru_frenzied_regeneration::HandlePeriodic(), AuraEffect::HandlePeriodicDummyAuraTick(), AuraEffect::HandlePeriodicManaLeechAuraTick(), AuraEffect::HandlePeriodicTriggerSpellAuraTick(), spell_deathbringer_blood_link_aura::HandleProc(), spell_deathbringer_blood_link_blood_beast_aura::HandleProc(), spell_soul_deflection::HandleProc(), spell_reliquary_of_souls_aura_of_desire_aura::HandleProc(), spell_black_temple_consuming_strikes_aura::HandleProc(), spell_gen_petrified_bark::HandleProc(), spell_gen_overlords_brand::HandleProc(), spell_gen_overlords_brand_dot::HandleProc(), spell_item_blade_ward_enchant::HandleProc(), spell_item_blood_draining_enchant::HandleProc(), spell_dk_butchery::HandleProc(), spell_dk_vendetta::HandleProc(), spell_dru_living_seed_proc::HandleProc(), spell_dru_glyph_of_innervate::HandleProc(), spell_dru_leader_of_the_pack::HandleProc(), spell_hun_ascpect_of_the_viper::HandleProc(), spell_mage_empowered_fire::HandleProc(), spell_mage_magic_absorption::HandleProc(), spell_sha_earth_shield::HandleProc(), spell_sha_shamanistic_rage::HandleProc(), spell_anetheron_vampiric_aura::HandleProc(), spell_deathbringer_blood_beast_blood_link::HandleProc(), spell_the_lich_king_dark_hunger_aura::HandleProc(), spell_yogg_saron_grim_reprisal_aura::HandleProc(), spell_dk_improved_blood_presence_triggered::HandleProc(), spell_dk_blood_gorged::HandleProc(), spell_dk_necrosis::HandleProc(), spell_dru_living_seed::HandleProc(), spell_dru_glyph_of_rejuvenation::HandleProc(), spell_dru_t3_8p_bonus::HandleProc(), spell_dru_t10_restoration_4p_bonus_dummy::HandleProc(), spell_gen_blade_warding::HandleProc(), spell_gen_vampiric_touch::HandleProc(), spell_gen_earth_shield_toc::HandleProc(), spell_hun_glyph_of_arcane_shot::HandleProc(), spell_hun_thrill_of_the_hunt::HandleProc(), spell_hun_piercing_shots::HandleProc(), spell_item_blessing_of_ancient_kings::HandleProc(), spell_item_necrotic_touch::HandleProc(), spell_item_alchemists_stone::HandleProc(), spell_item_charm_witch_doctor::HandleProc(), spell_item_frozen_shadoweave::HandleProc(), spell_item_persistent_shield::HandleProc(), spell_item_pet_healing::HandleProc(), spell_mage_burnout::HandleProc(), spell_mage_master_of_elements::HandleProc(), spell_pal_seal_of_command_aura::HandleProc(), spell_pal_seal_of_righteousness::HandleProc(), spell_pal_sheath_of_light::HandleProc(), spell_pal_judgement_of_light_heal::HandleProc(), spell_pal_judgement_of_wisdom_mana::HandleProc(), spell_pal_spiritual_attunement::HandleProc(), spell_pal_glyph_of_holy_light_proc::HandleProc(), spell_pal_infusion_of_light::HandleProc(), spell_pal_t8_2p_bonus::HandleProc(), spell_pal_glyph_of_holy_light_dummy::HandleProc(), spell_pal_illumination::HandleProc(), spell_pal_light_s_beacon::HandleProc(), spell_pri_divine_aegis::HandleProc(), spell_pri_glyph_of_prayer_of_healing::HandleProc(), spell_pri_vampiric_embrace::HandleProc(), spell_pri_glyph_of_dispel_magic::HandleProc(), spell_pri_aq_3p_bonus::HandleProc(), spell_pri_t10_heal_2p_bonus::HandleProc(), spell_pri_blessed_recovery::HandleProc(), spell_rog_blade_flurry::HandleProc(), spell_rog_quick_recovery::HandleProc(), spell_sha_item_mana_surge::HandleProc(), spell_sha_nature_guardian::HandleProc(), spell_sha_glyph_of_healing_wave::HandleProc(), spell_sha_spirit_hunt::HandleProc(), spell_sha_lightning_overload::HandleProc(), spell_sha_ancestral_awakening::HandleProc(), spell_sha_flametongue_weapon::HandleProc(), spell_sha_glyph_of_totem_of_wrath::HandleProc(), spell_sha_windfury_weapon::HandleProc(), spell_warl_soul_leech::HandleProc(), spell_warr_sweeping_strikes::HandleProc(), spell_warr_deep_wounds_aura::HandleProc(), spell_warr_item_t10_prot_4p_bonus::HandleProc(), spell_dk_wandering_plague_aura::HandleProc(), spell_gen_vampiric_might::HandleProc(), spell_gen_mirrored_soul::HandleProc(), spell_warl_improved_drain_soul::HandleProc(), AuraEffect::HandleProcTriggerSpellWithValueAuraProc(), AuraEffect::HandleRaidProcFromChargeWithValueAuraProc(), spell_igb_rocket_pack_aura::HandleRemove(), spell_warl_haunt_aura::HandleRemove(), spell_pal_lay_on_hands::HandleScript(), spell_kelthuzad_detonate_mana_aura::HandleScript(), spell_hun_chimera_shot::HandleScriptEffect(), spell_sha_stoneclaw_totem::HandleScriptEffect(), spell_pal_seal_of_vengeance_aura::HandleSeal(), AuraEffect::HandleShapeshiftBoosts(), spell_illidari_council_circle_of_healing::HandleSharedRule(), HandleSpellClick(), spell_halion_damage_aoe_summon::HandleSummon(), spell_putricide_mutated_transformation::HandleSummon(), spell_putricide_mutated_plague_aura::HandleTriggerSpell(), boss_sathrovarr::JustEngagedWith(), boss_essence_of_suffering::boss_essence_of_sufferingAI::JustEngagedWith(), boss_essence_of_anger::boss_essence_of_angerAI::JustEngagedWith(), boss_felblood_kaelthas::JustEngagedWith(), boss_kalecgos::JustEngagedWith(), boss_gurtogg_bloodboil::JustEngagedWith(), boss_teron_gorefiend::JustEngagedWith(), boss_najentus::JustEngagedWith(), boss_morogrim_tidewalker::JustEngagedWith(), boss_felmyst::MovementInform(), boss_sindragosa::boss_sindragosaAI::MovementInform(), npc_janalai_hatcher::MovementInform(), npc_frost_tomb::npc_frost_tomb(), spell_dru_tiger_s_fury::OnHit(), spell_gen_flurry_of_claws::OnPeriodic(), spell_blood_queen_essence_of_the_blood_queen_aura::OnProc(), spell_pal_eye_for_an_eye::OnProc(), spell_pal_glyph_of_divinity::OnProc(), spell_warl_siphon_life::OnProc(), spell_warl_fel_synergy::OnProc(), spell_warr_improved_spell_reflection::OnProc(), spell_warr_damage_shield::OnProc(), spell_kalecgos_curse_of_boundless_agony_aura::OnRemove(), spell_halion_marks_aura::OnRemove(), spell_putricide_mutated_plague_aura::OnRemove(), spell_the_lich_king_necrotic_plague_aura::OnRemove(), spell_yogg_saron_malady_of_the_mind_aura::OnRemove(), spell_sindragosa_instability_aura::OnRemove(), spell_the_lich_king_necrotic_plague_jump_aura::OnRemove(), npc_wild_wyrm::PassengerBoarded(), spell_karazhan_overload_aura::PeriodicTick(), spell_entropius_negative_energy_periodic::PeriodicTick(), spell_doomfire::PeriodicTick(), spell_blood_queen_pact_of_the_darkfallen_dmg_aura::PeriodicTick(), spell_broggok_poison_cloud::PeriodicTick(), spell_sha_mana_tide::PeriodicTick(), boss_reliquary_of_souls::boss_reliquary_of_soulsAI::PhaseTransitionSpawns(), spell_item_oracle_ablutions::PrepareSpellScript(), spell_q11198_take_down_tethyr::PrepareSpellScript(), SmartScript::ProcessAction(), spell_illidari_council_reflective_shield_aura::ReflectDamage(), spell_pri_power_word_shield_aura::ReflectDamage(), boss_kiljaeden::Reset(), npc_tournament_training_dummy::npc_tournament_training_dummyAI::Reset(), boss_kiljaeden::ScheduleBasicAbilities(), boss_magtheridon::ScheduleCombatEvents(), boss_lady_deathwhisper::boss_lady_deathwhisperAI::SpellHitTarget(), npc_simon_bunny::npc_simon_bunnyAI::SpellHitTarget(), boss_viscidus::SummonedCreatureDies(), boss_krik_thir::boss_krik_thirAI::SummonWatcher(), spell_dk_anti_magic_shell_self::Trigger(), spell_mage_incanters_absorbtion_base_AuraScript::Trigger(), spell_the_lich_king_life_siphon::TriggerHeal(), spell_pal_divine_storm::TriggerHeal(), spell_black_temple_shadow_inferno_aura::Update(), spell_black_temple_spell_absorption_aura::Update(), npc_coren_direbrew::UpdateAI(), boss_huhuran::UpdateAI(), boss_halion::boss_halionAI::UpdateAI(), boss_saviana_ragefire::boss_saviana_ragefireAI::UpdateAI(), boss_anubarak_trial::boss_anubarak_trialAI::UpdateAI(), boss_bronjahm::boss_bronjahmAI::UpdateAI(), boss_devourer_of_souls::boss_devourer_of_soulsAI::UpdateAI(), boss_festergut::boss_festergutAI::UpdateAI(), boss_rotface::boss_rotfaceAI::UpdateAI(), npc_valkyr_shadowguard::npc_valkyr_shadowguardAI::UpdateAI(), boss_gluth::boss_gluthAI::UpdateAI(), boss_noth::boss_nothAI::UpdateAI(), boss_sapphiron::boss_sapphironAI::UpdateAI(), boss_malygos::UpdateAI(), boss_algalon_the_observer::UpdateAI(), npc_living_constellation::UpdateAI(), boss_freya::UpdateAI(), boss_freya_elder_brightleaf::UpdateAI(), boss_freya_elder_ironbranch::UpdateAI(), npc_ulduar_hodir_priest::UpdateAI(), boss_ignis::UpdateAI(), npc_ulduar_vx001::UpdateAI(), boss_thorim::UpdateAI(), boss_xt002::UpdateAI(), boss_yoggsaron_sara::UpdateAI(), boss_yoggsaron::UpdateAI(), boss_ymiron::boss_ymironAI::UpdateAI(), boss_emalon::boss_emalonAI::UpdateAI(), and boss_toravon::boss_toravonAI::UpdateAI().

◆ CastDelayedSpellWithPeriodicAmount()

void Unit::CastDelayedSpellWithPeriodicAmount ( Unit caster,
uint32  spellId,
AuraType  auraType,
int32  addAmount,
uint8  effectIndex = 0 
)
16401{
16402 AuraEffect* aurEff = nullptr;
16403 for (AuraEffectList::iterator i = m_modAuras[auraType].begin(); i != m_modAuras[auraType].end(); ++i)
16404 {
16405 aurEff = *i;
16406 if (aurEff->GetCasterGUID() != caster->GetGUID() || aurEff->GetId() != spellId || aurEff->GetEffIndex() != effectIndex || !aurEff->GetTotalTicks())
16407 continue;
16408
16409 addAmount += ((aurEff->GetOldAmount() * std::max<int32>(aurEff->GetTotalTicks() - int32(aurEff->GetTickNumber()), 0)) / aurEff->GetTotalTicks());
16410 break;
16411 }
16412
16413 // xinef: delay only for casting on different unit
16414 if (this == caster || !sWorld->getBoolConfig(CONFIG_MUNCHING_BLIZZLIKE))
16415 caster->CastCustomSpell(spellId, SPELLVALUE_BASE_POINT0, addAmount, this, TriggerCastFlags(TRIGGERED_FULL_MASK & ~TRIGGERED_NO_PERIODIC_RESET), nullptr, aurEff, caster->GetGUID());
16416 else
16417 caster->m_Events.AddEvent(new AuraMunchingQueue(*caster, GetGUID(), addAmount, spellId, aurEff, auraType), caster->m_Events.CalculateQueueTime(400));
16418}
TriggerCastFlags
Definition SpellDefines.h:132
@ TRIGGERED_NO_PERIODIC_RESET
Will ignore equipped item requirements.
Definition SpellDefines.h:152
@ CONFIG_MUNCHING_BLIZZLIKE
Definition WorldConfig.h:144
uint32 GetTickNumber() const
Definition SpellAuraEffects.h:87
int32 GetOldAmount() const
Definition SpellAuraEffects.h:116
uint32 GetId() const
Definition SpellAuraEffects.cpp:432
int32 GetTotalTicks() const
Definition SpellAuraEffects.cpp:7388
ObjectGuid GetCasterGUID() const
Definition SpellAuraEffects.h:48
Definition Unit.cpp:16367
uint64 CalculateQueueTime(uint64 delay) const
Definition EventProcessor.cpp:164
void AddEvent(BasicEvent *Event, uint64 e_time, bool set_addtime=true, uint8 eventGroup=0)
Definition EventProcessor.cpp:136

References EventProcessor::AddEvent(), EventProcessor::CalculateQueueTime(), CastCustomSpell(), CONFIG_MUNCHING_BLIZZLIKE, AuraEffect::GetCasterGUID(), AuraEffect::GetEffIndex(), Object::GetGUID(), Object::GetGUID(), AuraEffect::GetId(), AuraEffect::GetOldAmount(), AuraEffect::GetTickNumber(), AuraEffect::GetTotalTicks(), WorldObject::m_Events, m_modAuras, SPELLVALUE_BASE_POINT0, sWorld, TRIGGERED_FULL_MASK, and TRIGGERED_NO_PERIODIC_RESET.

Referenced by spell_mage_ignite::HandleProc(), spell_dk_unholy_blight::HandleProc(), spell_dru_t10_balance_4p_bonus::HandleProc(), spell_pal_righteous_vengeance::HandleProc(), spell_sha_t10_restoration_4p_bonus::HandleProc(), spell_sha_t8_electrified::HandleProc(), spell_sha_t8_elemental_4p_bonus::HandleProc(), and spell_sha_t9_elemental_4p_bonus::HandleProc().

◆ CastPetAura()

void Unit::CastPetAura ( PetAura const *  aura)
13836{
13837 uint32 auraId = aura->GetAura(GetEntry());
13838 if (!auraId)
13839 return;
13840
13841 if (auraId == 35696) // Demonic Knowledge
13842 {
13843 int32 basePoints = aura->GetDamage();
13844 CastCustomSpell(this, auraId, &basePoints, nullptr, nullptr, true);
13845 }
13846 else
13847 CastSpell(this, auraId, true);
13848}

References CastCustomSpell(), CastSpell(), PetAura::GetAura(), PetAura::GetDamage(), and Object::GetEntry().

Referenced by Pet::CastPetAuras().

◆ CastSpell() [1/7]

SpellCastResult Unit::CastSpell ( float  x,
float  y,
float  z,
uint32  spellId,
bool  triggered,
Item castItem = nullptr,
AuraEffect const *  triggeredByAura = nullptr,
ObjectGuid  originalCaster = ObjectGuid::Empty 
)
1406{
1407 SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId);
1408 if (!spellInfo)
1409 {
1410 LOG_ERROR("entities.unit", "CastSpell: unknown spell {} by caster {}", spellId, GetGUID().ToString());
1412 }
1413
1414 SpellCastTargets targets;
1415 targets.SetDst(x, y, z, GetOrientation());
1416
1417 return CastSpell(targets, spellInfo, nullptr, triggered ? TRIGGERED_FULL_MASK : TRIGGERED_NONE, castItem, triggeredByAura, originalCaster);
1418}
void SetDst(float x, float y, float z, float orientation, uint32 mapId=MAPID_INVALID)
Definition Spell.cpp:405

References CastSpell(), Object::GetGUID(), Position::GetOrientation(), LOG_ERROR, SpellCastTargets::SetDst(), SPELL_FAILED_SPELL_UNAVAILABLE, sSpellMgr, Position::ToString(), TRIGGERED_FULL_MASK, and TRIGGERED_NONE.

◆ CastSpell() [2/7]

SpellCastResult Unit::CastSpell ( GameObject go,
uint32  spellId,
bool  triggered,
Item castItem = nullptr,
AuraEffect triggeredByAura = nullptr,
ObjectGuid  originalCaster = ObjectGuid::Empty 
)
1421{
1422 SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId);
1423 if (!spellInfo)
1424 {
1425 LOG_ERROR("entities.unit", "CastSpell: unknown spell {} by caster {}", spellId, GetGUID().ToString());
1427 }
1428
1429 SpellCastTargets targets;
1430 targets.SetGOTarget(go);
1431
1432 return CastSpell(targets, spellInfo, nullptr, triggered ? TRIGGERED_FULL_MASK : TRIGGERED_NONE, castItem, triggeredByAura, originalCaster);
1433}
void SetGOTarget(GameObject *target)
Definition Spell.cpp:270

References CastSpell(), Object::GetGUID(), LOG_ERROR, SpellCastTargets::SetGOTarget(), SPELL_FAILED_SPELL_UNAVAILABLE, sSpellMgr, Position::ToString(), TRIGGERED_FULL_MASK, and TRIGGERED_NONE.

◆ CastSpell() [3/7]

SpellCastResult Unit::CastSpell ( SpellCastTargets const &  targets,
SpellInfo const *  spellInfo,
CustomSpellValues const *  value,
TriggerCastFlags  triggerFlags = TRIGGERED_NONE,
Item castItem = nullptr,
AuraEffect const *  triggeredByAura = nullptr,
ObjectGuid  originalCaster = ObjectGuid::Empty 
)
Todo:
: this is a workaround - not needed anymore, but required for some scripts :(
1303{
1304 if (!spellInfo)
1305 {
1306 LOG_ERROR("entities.unit", "CastSpell: unknown spell by caster {}", GetGUID().ToString());
1308 }
1309
1311 if (!originalCaster && triggeredByAura)
1312 {
1313 originalCaster = triggeredByAura->GetCasterGUID();
1314 }
1315
1316 Spell* spell = new Spell(this, spellInfo, triggerFlags, originalCaster);
1317
1318 if (value)
1319 {
1320 for (CustomSpellValues::const_iterator itr = value->begin(); itr != value->end(); ++itr)
1321 {
1322 spell->SetSpellValue(itr->first, itr->second);
1323 }
1324 }
1325
1326 spell->m_CastItem = castItem;
1327 return spell->prepare(&targets, triggeredByAura);
1328}
void SetSpellValue(SpellValueMod mod, int32 value)
Definition Spell.cpp:8417
Item * m_CastItem
Definition Spell.h:532

References AuraEffect::GetCasterGUID(), Object::GetGUID(), LOG_ERROR, Spell::m_CastItem, Spell::prepare(), Spell::SetSpellValue(), SPELL_FAILED_SPELL_UNAVAILABLE, and Position::ToString().

Referenced by Player::_addSpell(), Player::_addTalentAurasAndSpells(), Spell::_cast(), _ExitVehicle(), Player::_LoadGlyphAuras(), Battleground::_ProcessResurrect(), spell_yogg_saron_protective_gaze_aura::Absorb(), spell_rog_cheat_death::Absorb(), npc_q24545_wretched_ghoul::npc_q24545_wretched_ghoulAI::Activate(), Player::ActivateSpec(), spell_halion_combustion_consumption_aura::AddMarkStack(), Battleground::AddPlayer(), Arena::AddPlayer(), BattlegroundIC::AddPlayer(), BattlegroundMap::AddPlayerToMap(), Battleground::AddPlayerToResurrectQueue(), Pet::addSpell(), spell_item_thrallmar_and_honor_hold_favor::AfterApply(), spell_dru_savage_roar_aura::AfterApply(), spell_the_cleansing_cleansing_soul::AfterRemove(), spell_astromancer_wrath_of_the_astromancer::AfterRemove(), spell_item_darkmoon_card_illusion::AfterRemove(), spell_gen_lifebloom::AfterRemove(), spell_oculus_stop_time_aura::Apply(), spell_sha_earthbind_totem::Apply(), spell_warl_health_funnel::ApplyEffect(), Player::ApplyEnchantment(), Player::ApplyEquipSpell(), Player::ApplyItemObtainSpells(), npc_ritual_channeler::npc_ritual_channelerAI::AttackStart(), npc_dark_nucleus::npc_dark_nucleusAI::AttackStart(), boss_grand_champion::boss_grand_championAI::boss_grand_championAI(), boss_yoggsaron_crusher_tentacle::boss_yoggsaron_crusher_tentacle(), boss_yoggsaron_death_orb::boss_yoggsaron_death_orb(), boss_yoggsaron_influence_tentacle::boss_yoggsaron_influence_tentacle(), WorldState::BuffAdalsSongOfBattle(), WorldState::BuffMagtheridonTeam(), Player::BuildPlayerRepop(), spell_igb_incinerating_blast::CalculateDamage(), spell_igb_cannon_blast::CalculatePower(), npc_echo_of_medivh::CastChangeFacing(), npc_chesspiece::CastChangeFacing(), CastCustomSpell(), npc_hallows_end_soh::CastFires(), Player::CastItemCombatSpell(), npc_volatile_ooze::npc_volatile_oozeAI::CastMainSpell(), CastPetAura(), boss_mor_grayhoof::CastRandomSpell(), CastSpell(), CastSpell(), GameObject::CastSpell(), CastSpell(), CastSpell(), CastSpell(), CastSpell(), spell_the_lich_king_defile::ChangeDamageAndGrow(), boss_professor_putricide::boss_professor_putricideAI::ChangePhase(), spell_eredar_twins_handle_touch::CheckCast(), Spell::CheckCast(), Spell::CheckItems(), spell_botanica_shift_form_aura::CheckProc(), spell_mage_combustion::CheckProc(), boss_isle_of_conquest::boss_isle_of_conquestAI::CheckRageBuff(), spell_the_lich_king_shadow_trap_periodic::CheckTargetCount(), spell_dk_raise_dead::ConsumeReagents(), spell_frost_giant_death_plague::CountTargets(), instance_blackrock_spire::instance_blackrock_spireMapScript::CreatureLooted(), violet_hold_trashAI::CreatureStartAttackDoor(), boss_garfrost::boss_garfrostAI::DamageTaken(), npc_jenny::DamageTaken(), boss_baron_geddon::boss_baron_geddonAI::DamageTaken(), boss_headless_horseman::DamageTaken(), boss_headless_horseman_head::DamageTaken(), boss_sartharion::DamageTaken(), boss_eadric::boss_eadricAI::DamageTaken(), boss_paletress::boss_paletressAI::DamageTaken(), npc_argent_soldier::npc_argent_soldierAI::DamageTaken(), boss_black_knight::boss_black_knightAI::DamageTaken(), boss_bronjahm::boss_bronjahmAI::DamageTaken(), npc_high_overlord_saurfang_igb::npc_high_overlord_saurfang_igbAI::DamageTaken(), npc_muradin_bronzebeard_igb::npc_muradin_bronzebeard_igbAI::DamageTaken(), npc_gunship_boarding_addAI::DamageTaken(), npc_shambling_horror_icc::npc_shambling_horror_iccAI::DamageTaken(), npc_terenas_menethil::npc_terenas_menethilAI::DamageTaken(), npc_crok_scourgebane::npc_crok_scourgebaneAI::DamageTaken(), npc_power_spark::DamageTaken(), npc_collapsing_star::DamageTaken(), boss_freya::DamageTaken(), boss_hodir::DamageTaken(), npc_ulduar_leviathan_mkii::DamageTaken(), npc_ulduar_vx001::DamageTaken(), npc_ulduar_aerial_command_unit::DamageTaken(), npc_ulduar_arachnopod_destroyer::DamageTaken(), npc_blistering_zombie::npc_blistering_zombieAI::DamageTaken(), npc_death_knight_initiate::npc_death_knight_initiateAI::DamageTaken(), npc_tiger_matriarch::npc_tiger_matriarchAI::DamageTaken(), boss_the_lich_king::boss_the_lich_kingAI::DamageTaken(), npc_ulduar_iron_construct::DamageTaken(), boss_mal_ganis::boss_mal_ganisAI::DamageTaken(), boss_thorim::DamageTaken(), boss_yoggsaron_brain::DamageTaken(), DealDamage(), DealMeleeDamage(), spell_warl_seed_of_corruption_aura::Detonate(), spell_warl_seed_of_corruption_generic_aura::Detonate(), boss_twin_valkyrAI::DoAction(), npc_icc_ice_sphere::npc_icc_ice_sphereAI::DoAction(), npc_icc_severed_essence::npc_icc_severed_essenceAI::DoAction(), npc_q24545_wretched_ghoul::npc_q24545_wretched_ghoulAI::DoAction(), npc_eris_hevenfire::npc_eris_hevenfireAI::DoAction(), boss_baltharus_the_warborn::boss_baltharus_the_warbornAI::DoAction(), boss_prince_keleseth_icc::boss_prince_kelesethAI::DoAction(), boss_prince_taldaram_icc::boss_prince_taldaramAI::DoAction(), boss_prince_valanar_icc::boss_prince_valanarAI::DoAction(), npc_ball_of_flame::npc_ball_of_flameAI::DoAction(), boss_deathbringer_saurfang::boss_deathbringer_saurfangAI::DoAction(), boss_the_lich_king::boss_the_lich_kingAI::DoAction(), npc_strangulate_vehicle::npc_strangulate_vehicleAI::DoAction(), npc_terenas_menethil::npc_terenas_menethilAI::DoAction(), boss_algalon_the_observer::DoAction(), boss_flame_leviathan::DoAction(), boss_magtheridon::DoAction(), boss_sacrolash::DoAction(), boss_alythess::DoAction(), npc_kalecgos_kj::DoAction(), npc_pilgrims_bounty_chair::DoAction(), boss_black_knight::boss_black_knightAI::DoAction(), boss_jormungarAI::DoAction(), boss_tyrannus::boss_tyrannusAI::DoAction(), npc_icc_blood_beast::npc_icc_blood_beastAI::DoAction(), npc_icc_putricades_trap::npc_icc_putricades_trapAI::DoAction(), npc_spark_of_ionar::DoAction(), npc_molten_golem::DoAction(), boss_steelbreaker::DoAction(), npc_ulduar_bot_summon_trigger::DoAction(), boss_thorim_sif::DoAction(), boss_xt002::DoAction(), npc_xt002_heart::DoAction(), boss_yoggsaron_sara::DoAction(), boss_yoggsaron_cloud::DoAction(), boss_yoggsaron::DoAction(), boss_yoggsaron_brain::DoAction(), boss_yoggsaron_keeper::DoAction(), Spell::DoAllEffectOnTarget(), UnitAI::DoCast(), UnitAI::DoCast(), UnitAI::DoCastAOE(), ScriptedAI::DoCastSpell(), InstanceScript::DoCastSpellOnPlayer(), InstanceScript::DoCastSpellOnPlayers(), UnitAI::DoCastToAllHostilePlayers(), boss_maexxna::boss_maexxnaAI::DoCastWebWrap(), boss_ichoron::boss_ichoronAI::DoExplodeCompleted(), npc_midsummer_ribbon_pole_target::DoFireworkChecks(), npc_midsummer_ribbon_pole_target::DoGroundFlowerChecks(), UnitAI::DoSpellAttackIfReady(), UnitAI::DoSpellAttackToRandomTargetIfReady(), npc_midsummer_ribbon_pole_target::DoSpewLavaChecks(), boss_skeram::DoTeleport(), Spell::DoTriggersOnSpellHit(), Player::DuelComplete(), Spell::EffectActivateRune(), Spell::EffectApplyGlyph(), Spell::EffectCastButtons(), Spell::EffectDummy(), Spell::EffectEnergize(), Spell::EffectForceCast(), Spell::EffectHeal(), Spell::EffectInebriate(), Spell::EffectSchoolDMG(), Spell::EffectScriptEffect(), Spell::EffectStuck(), Spell::EffectSummonType(), Spell::EffectTaunt(), Spell::EffectTeleportUnits(), Spell::EffectTitanGrip(), Spell::EffectTriggerMissileSpell(), Spell::EffectTriggerRitualOfSummoning(), Spell::EffectTriggerSpell(), Spell::EffectWeaponDmg(), boss_lady_deathwhisper::boss_lady_deathwhisperAI::EmpowerCultist(), boss_the_lich_king::boss_the_lich_kingAI::EnterEvadeMode(), BattlegroundEY::EventPlayerClickedOnFlag(), BattlegroundWS::EventPlayerClickedOnFlag(), BattlegroundEY::EventPlayerDroppedFlag(), BattlegroundWS::EventPlayerDroppedFlag(), BattlegroundEY::EventTeamCapturedPoint(), BattleExperienceEvent::Execute(), OrcDeathEvent::Execute(), CorruptTriggers::Execute(), CastArmageddon::Execute(), UtherBatteredHiltEvent::Execute(), ShockVortexExplodeEvent::Execute(), ResetEncounterEvent::Execute(), FrostBombExplosion::Execute(), IceTombSummonEvent::Execute(), VileSpiritActivateEvent::Execute(), LichKingMovieEvent::Execute(), DelayedCastEvent::Execute(), DelayedCastMincharEvent::Execute(), ChargeRifts::Execute(), CosmicSmashDamageEvent::Execute(), CastRunesEvent::Execute(), BoomEvent::Execute(), SACActivateEvent::Execute(), VerasEnvenom::Execute(), CastQuill::Execute(), lapseTeleport::Execute(), boss_kaelthas::ExecuteMiddleEvent(), boss_salramm::boss_salrammAI::ExplodeGhoul(), spell_festergut_blighted_spores_aura::ExtraEffect(), spell_rotface_mutated_infection_aura::ExtraRemoveEffect(), npc_dark_iron_attack_generator::FinishAttackDueToWin(), npc_azure_saboteur::npc_azure_saboteurAI::FinishPointReached(), npc_pet_dk_ebon_gargoyle::FlyAway(), npc_valkyr_shadowguard::npc_valkyr_shadowguardAI::GoSiphon(), go_soulwell::go_soulwellAI::GossipHello(), spell_cataclysm_breath::HandleAfterCast(), spell_dk_chains_of_ice::HandleAfterCast(), spell_mage_arcane_blast::HandleAfterCast(), spell_q13086_last_line_of_defence::HandleAfterCast(), spell_braziers_hit::HandleAfterEffectApply(), spell_infected_worgen_bite_aura::HandleAfterEffectApply(), spell_dk_blood_boil::HandleAfterHit(), spell_dk_scourge_strike::HandleAfterHit(), spell_rog_deadly_poison::HandleAfterHit(), spell_warlords_rage::HandleAfterRemove(), npc_anachronos_the_ancient::npc_anachronos_the_ancientAI::HandleAnimation(), spell_felmyst_fog_of_corruption_charm_aura::HandleApply(), spell_kiljaeden_vengeance_of_the_blue_flight_aura::HandleApply(), spell_boss_magus_telestra_summon_telestra_clones_aura::HandleApply(), spell_dru_enrage::HandleApply(), spell_rog_killing_spree_aura::HandleApply(), spell_warr_vigilance::HandleApply(), spell_azjol_nerub_pound::HandleApplyAura(), spell_pal_seal_of_vengeance_aura::HandleApplyDoT(), BattlegroundIC::HandleAreaTrigger(), OutdoorPvPSI::HandleAreaTrigger(), AuraEffect::HandleAuraDummy(), AuraEffect::HandleAuraLinked(), AuraEffect::HandleAuraModShapeshift(), HandleAuraRaidProcFromCharge(), HandleAuraRaidProcFromChargeWithValue(), Aura::HandleAuraSpecificMods(), spell_dk_death_grip::HandleBaseDummy(), misc_commandscript::HandleBindSightCommand(), spell_sha_maelstrom_weapon::HandleBonus(), spell_mirkblood_dash_gash_return_to_tank_pre_spell::HandleCast(), spell_rotface_unstable_ooze_explosion_init::HandleCast(), spell_commander_sarannis_summon_reinforcements::HandleCast(), cast_commandscript::HandleCastBackCommand(), cast_commandscript::HandleCastCommand(), cast_commandscript::HandleCastDestCommand(), cast_commandscript::HandleCastDistCommand(), cast_commandscript::HandleCastSelfCommand(), cast_commandscript::HandleCastTargetCommad(), spell_gen_mounted_charge::HandleChargeEffect(), spell_dk_corpse_explosion::HandleCorpseExplosion(), OutdoorPvPSI::HandleCustomSpell(), WorldSession::HandleDuelCancelledOpcode(), spell_icc_shattered_bones::HandleDummy(), spell_player_mount_wyrm::HandleDummy(), spell_corrupted_totems::HandleDummy(), spell_moroes_vanish::HandleDummy(), spell_karazhan_blink::HandleDummy(), spell_karazhan_wrath_titans_stacker::HandleDummy(), spell_ooze_zap::HandleDummy(), spell_saviana_conflagration_init::HandleDummy(), spell_igb_burning_pitch_selector::HandleDummy(), spell_igb_burning_pitch::HandleDummy(), spell_charge_shield_bomber::HandleDummy(), spell_fight_fire_bomber::HandleDummy(), spell_anti_air_rocket_bomber::HandleDummy(), spell_q13007_iron_colossus::HandleDummy(), spell_illidan_found_target::HandleDummy(), spell_leotheras_chaos_blast::HandleDummy(), spell_morogrim_tidewalker_watery_grave::HandleDummy(), spell_q10935_the_exorcism_of_colonel_jules::HandleDummy(), spell_gen_focused_bursts::HandleDummy(), spell_shadowblink::HandleDummy(), spell_spawn_drakonid::HandleDummy(), spell_send_mug_target_picker::HandleDummy(), spell_hallows_end_candy::HandleDummy(), spell_hallows_end_bucket_lands::HandleDummy(), spell_midsummer_torch_catch::HandleDummy(), spell_pilgrims_bounty_pass_generic::HandleDummy(), spell_pilgrims_bounty_feast_on_generic::HandleDummy(), spell_mana_burn_area::HandleDummy(), spell_voljin_war_drums::HandleDummy(), spell_voodoo::HandleDummy(), spell_sartharion_lava_strike::HandleDummy(), spell_halion_meteor_strike_targeting::HandleDummy(), spell_halion_twilight_division::HandleDummy(), spell_drakkari_colossus_emerge::HandleDummy(), spell_drakkari_colossus_surge::HandleDummy(), spell_putricide_ooze_eruption_searcher::HandleDummy(), spell_voa_flaming_cinder::HandleDummy(), spell_q12096_q12092_dummy::HandleDummy(), spell_vehicle_warhead_fuse::HandleDummy(), spell_q12589_shoot_rjr::HandleDummy(), spell_fatal_strike::HandleDummy(), spell_najentus_needle_spine::HandleDummy(), spell_ice_spear_target_picker::HandleDummy(), spell_dru_starfall_dummy::HandleDummy(), spell_gen_cannibalize::HandleDummy(), spell_gen_gadgetzan_transporter_backfire::HandleDummy(), spell_gen_gnomish_transporter::HandleDummy(), spell_hun_masters_call::HandleDummy(), spell_hun_pet_carrion_feeder::HandleDummy(), spell_item_gnomish_universal_remote::HandleDummy(), spell_item_gnomish_shrink_ray::HandleDummy(), spell_item_trigger_spell::HandleDummy(), spell_item_deviate_fish::HandleDummy(), spell_item_flask_of_the_north::HandleDummy(), spell_item_make_a_wish::HandleDummy(), spell_item_mingos_fortune_generator::HandleDummy(), spell_item_net_o_matic::HandleDummy(), spell_item_noggenfogger_elixir::HandleDummy(), spell_item_savory_deviate_delight::HandleDummy(), spell_item_six_demon_bag::HandleDummy(), spell_item_underbelly_elixir::HandleDummy(), spell_item_vanquished_clutches::HandleDummy(), spell_item_purify_helboar_meat::HandleDummy(), spell_item_reindeer_transformation::HandleDummy(), spell_item_nigh_invulnerability::HandleDummy(), spell_item_poultryizer::HandleDummy(), spell_item_socrethars_stone::HandleDummy(), spell_item_demon_broiled_surprise::HandleDummy(), spell_item_complete_raptor_capture::HandleDummy(), spell_item_brewfest_mount_transformation::HandleDummy(), spell_item_nitro_boots::HandleDummy(), spell_item_teach_language::HandleDummy(), spell_item_rocket_boots::HandleDummy(), spell_item_pygmy_oil::HandleDummy(), spell_item_chicken_cover::HandleDummy(), spell_item_greatmothers_soulcatcher::HandleDummy(), spell_item_lifegiving_gem::HandleDummy(), spell_item_mind_control_cap::HandleDummy(), spell_item_hourglass_sand::HandleDummy(), spell_item_ultrasafe_transporter::HandleDummy(), spell_mage_summon_water_elemental::HandleDummy(), spell_pal_blessing_of_faith::HandleDummy(), spell_pal_holy_shock::HandleDummy(), spell_pal_judgement_of_command::HandleDummy(), spell_pri_penance::HandleDummy(), spell_q11520_discovering_your_roots::HandleDummy(), spell_q5206_test_fetid_skull::HandleDummy(), spell_q11396_11399_scourging_crystal_controller::HandleDummy(), spell_q11587_arcane_prisoner_rescue::HandleDummy(), spell_q11730_ultrasonic_screwdriver::HandleDummy(), spell_q12634_despawn_fruit_tosser::HandleDummy(), spell_q12683_take_sputum_sample::HandleDummy(), spell_q9452_cast_net::HandleDummy(), spell_q13291_q13292_q13239_q13261_frostbrood_skytalon_grab_decoy::HandleDummy(), spell_q12308_escape_from_silverbrook::HandleDummy(), spell_q12641_death_comes_from_on_high::HandleDummy(), spell_rog_shiv::HandleDummy(), spell_sha_fire_nova::HandleDummy(), spell_warl_ritual_of_doom_effect::HandleDummy(), spell_warl_soulshatter::HandleDummy(), spell_warr_charge::HandleDummy(), spell_warr_warriors_wrath::HandleDummy(), spell_magtheridon_shadow_grasp::HandleDummyApply(), spell_yogg_saron_destabilization_matrix::HandleDummyEffect(), spell_yogg_saron_insane_periodic_trigger::HandleDummyEffect(), spell_image_of_drakuru_reagent_check::HandleDummyEffect(), spell_herald_volzaj_insanity::HandleDummyEffect(), spell_talon_king_ikiss_blink::HandleDummyHitTarget(), spell_shadowfang_keep_forsaken_skills_aura::HandleDummyTick(), spell_item_rocket_chicken::HandleDummyTick(), spell_warl_demonic_circle_summon::HandleDummyTick(), spell_shadowfang_keep_haunting_spirits_aura::HandleDummyTick(), spell_blood_council_shadow_prison_aura::HandleDummyTick(), spell_mark_of_nature::HandleEffect(), spell_call_of_the_beast::HandleEffect(), spell_target_fissures::HandleEffect(), spell_rog_vanish::HandleEffect(), spell_mc_play_dead_aura::HandleEffectApply(), spell_lich_king_vo_blocker::HandleEffectApply(), spell_midsummer_ribbon_pole::HandleEffectApply(), spell_tharon_ja_dummy_aura::HandleEffectApply(), spell_reliquary_of_souls_aura_of_suffering_aura::HandleEffectApply(), spell_teron_gorefiend_shadowy_construct::HandleEffectApply(), spell_leotheras_insidious_whisper_aura::HandleEffectApply(), spell_pal_aura_mastery::HandleEffectApply(), spell_pal_improved_aura::HandleEffectApply(), spell_q12851_going_bearback::HandleEffectApply(), spell_bloodspore_haze::HandleEffectHit(), spell_oculus_soar_aura::HandleEffectPeriodic(), spell_gen_whisper_gulch_yogg_saron_whisper::HandleEffectPeriodic(), spell_rog_killing_spree_aura::HandleEffectPeriodic(), spell_sha_earthbind_totem::HandleEffectPeriodic(), spell_brewfest_main_ram_buff::HandleEffectPeriodic(), spell_hodir_flash_freeze_aura::HandleEffectPeriodic(), spell_warr_retaliation::HandleEffectProc(), spell_tharon_ja_dummy_aura::HandleEffectRemove(), spell_q11919_q11940_drake_hunt_aura::HandleEffectRemove(), spell_illidan_parasitic_shadowfiend_aura::HandleEffectRemove(), spell_illidan_parasitic_shadowfiend_trigger_aura::HandleEffectRemove(), spell_teron_gorefiend_shadow_of_death::HandleEffectRemove(), spell_black_temple_skeleton_shot_aura::HandleEffectRemove(), spell_hydross_cleansing_field_command::HandleEffectRemove(), spell_serpentshrine_cavern_serpentshrine_parasite::HandleEffectRemove(), spell_serpentshrine_cavern_serpentshrine_parasite_trigger_aura::HandleEffectRemove(), spell_q10930_big_bone_worm_aura::HandleEffectRemove(), spell_q10929_fumping_aura::HandleEffectRemove(), spell_flamewreath::HandleFinish(), spell_midsummer_fling_torch::HandleFinish(), spell_midsummer_juggling_torch::HandleFinish(), spell_wintergrasp_rp_gg::HandleFinish(), spell_dreamwalker_summoner::HandleForceCast(), spell_dreamwalker_summon_suppresser_effect::HandleForceCast(), spell_ioc_bomb_blast_criteria::HandleGameObjectDamage(), OPvPCapturePointZM_Graveyard::HandleGossipOption(), spell_mirkblood_blood_mirror_target_picker::HandleHit(), spell_magtheridon_quake::HandleHit(), spell_chapter5_return_to_capital::HandleHit(), spell_dk_presence::HandleImprovedBloodPresence(), spell_dk_presence::HandleImprovedFrostPresence(), spell_dk_presence::HandleImprovedUnholyPresence(), spell_sindragosa_frost_breath::HandleInfusion(), OutdoorPvPHP::HandleKillImpl(), OutdoorPvPNA::HandleKillImpl(), OutdoorPvPZM::HandleKillImpl(), BattlegroundIC::HandleKillUnit(), WorldSession::HandleMoveSplineDoneOpcode(), WorldSession::HandleMoveTeleportAck(), WorldSession::HandleMoveWorldportAck(), spell_oculus_soar_aura::HandleOnEffectApply(), spell_oculus_rider_aura::HandleOnEffectApply(), spell_ticking_time_bomb_aura::HandleOnEffectRemove(), spell_delusions_of_jindo::HandleOnHit(), spell_arcane_vacuum::HandleOnHit(), spell_mark_of_frost_freeze::HandleOnHit(), spell_mutate_explode_bug::HandleOnHit(), spell_explode_trigger::HandleOnHit(), spell_blade_dance_targeting::HandleOnHit(), aura_class_call_wild_magic::HandlePeriodic(), spell_shadow_sickle_periodic_damage::HandlePeriodic(), spell_hadronox_summon_periodic_aura::HandlePeriodic(), spell_halion_meteor_strike_spread_aura::HandlePeriodic(), spell_sladran_grip_of_sladran_aura::HandlePeriodic(), spell_algalon_phase_punch_aura::HandlePeriodic(), spell_close_rift_aura::HandlePeriodic(), spell_serpentshrine_cavern_coilfang_water::HandlePeriodic(), spell_rancid_spore_cloud::HandlePeriodic(), spell_kaelthas_remote_toy::HandlePeriodic(), spell_q10923_evil_draws_near_periodic_aura::HandlePeriodic(), spell_sha_totemic_mastery::HandlePeriodic(), spell_garr_separation_anxiety_aura::HandlePeriodic(), spell_majordomo_separation_anxiety_aura::HandlePeriodic(), spell_kiljaeden_shadow_spike_aura::HandlePeriodic(), spell_kiljaeden_armageddon_periodic_aura::HandlePeriodic(), spell_halion_twilight_cutter_periodic_aura::HandlePeriodic(), spell_oculus_ride_ruby_emerald_amber_drake_que_aura::HandlePeriodic(), spell_hun_sniper_training::HandlePeriodic(), spell_shadow_bolt_whirl::HandlePeriodic(), spell_voa_overcharge_aura::HandlePeriodicDummy(), spell_item_dementia::HandlePeriodicDummy(), AuraEffect::HandlePeriodicDummyAuraTick(), spell_magtheridon_shadow_grasp::HandlePeriodicRemove(), spell_igb_periodic_trigger_with_power_cost_aura::HandlePeriodicTick(), spell_item_enchanted_broom_periodic::HandlePeriodicTick(), spell_bronjahm_soulstorm_channel_ooc_aura::HandlePeriodicTick(), spell_bronjahm_soulstorm_visual_aura::HandlePeriodicTick(), spell_item_direbrew_remote_aura::HandlePeriodicTick(), AuraEffect::HandlePeriodicTriggerSpellAuraTick(), npc_echo_of_medivh::HandlePieceMoveByAI(), WorldState::HandlePlayerEnterZone(), OutdoorPvPEP::HandlePlayerEnterZone(), OutdoorPvPHP::HandlePlayerEnterZone(), OutdoorPvPNA::HandlePlayerEnterZone(), OutdoorPvPSI::HandlePlayerEnterZone(), OutdoorPvPTF::HandlePlayerEnterZone(), OutdoorPvPZM::HandlePlayerEnterZone(), WorldSession::HandlePlayerLoginFromDB(), BattlegroundIC::HandlePlayerResurrect(), misc_commandscript::HandlePossessCommand(), spell_blood_queen_vampiric_bite::HandlePresence(), spell_mark_of_malice::HandleProc(), spell_item_lil_phylactery::HandleProc(), spell_item_fate_rune_of_unsurpassed_vigor::HandleProc(), spell_rog_tricks_of_the_trade::HandleProc(), spell_gyth_chromatic_protection::HandleProc(), spell_karazhan_wrath_titans_aura::HandleProc(), spell_ahune_spanky_hands::HandleProc(), spell_hun_glyph_of_mend_pet::HandleProc(), spell_item_trauma::HandleProc(), spell_item_shadows_fate::HandleProc(), spell_utgarde_pinnacle_beast_mark::HandleProc(), spell_dk_scent_of_blood::HandleProc(), spell_dru_t4_2p_bonus::HandleProc(), spell_dru_maim_interrupt::HandleProc(), spell_hun_improved_mend_pet::HandleProc(), spell_hun_misdirection::HandleProc(), spell_item_aegis_of_preservation::HandleProc(), spell_item_desperate_defense::HandleProc(), spell_mage_focus_magic::HandleProc(), spell_mage_arcane_potency::HandleProc(), spell_mage_imp_mana_gems::HandleProc(), spell_pal_blessing_of_sanctuary::HandleProc(), spell_pal_judgements_of_the_wise::HandleProc(), spell_pal_sacred_shield_dummy::HandleProc(), spell_pri_item_greater_heal_refund::HandleProc(), spell_pri_mana_leech::HandleProc(), spell_pri_t5_heal_2p_bonus::HandleProc(), spell_rog_turn_the_tables::HandleProc(), spell_warl_nightfall::HandleProc(), spell_warl_glyph_of_life_tap::HandleProc(), spell_warl_t4_2p_bonus_fire::HandleProc(), spell_warl_t4_2p_bonus_shadow::HandleProc(), spell_warr_vigilance::HandleProc(), spell_warr_second_wind::HandleProc(), spell_warr_extra_proc::HandleProc(), spell_warr_glyph_of_blocking::HandleProc(), spell_karazhan_temptation::HandleProc(), spell_putricide_ooze_tank_protection::HandleProc(), spell_uk_second_wind::HandleProc(), spell_twisted_reflection::HandleProc(), spell_pet_guard_dog::HandleProc(), spell_pet_silverback::HandleProc(), spell_dk_blood_caked_blade::HandleProc(), spell_dk_dancing_rune_weapon::HandleProc(), spell_dk_mark_of_blood::HandleProc(), spell_dk_sudden_doom::HandleProc(), spell_dk_threat_of_thassarian::HandleProc(), spell_dk_glyph_of_scourge_strike::HandleProc(), spell_dk_pvp_4p_bonus::HandleProc(), spell_dru_glyph_of_barkskin::HandleProc(), spell_dru_glyph_of_rake::HandleProc(), spell_dru_eclipse::HandleProc(), spell_dru_revitalize::HandleProc(), spell_dru_t3_2p_bonus::HandleProc(), spell_dru_t3_6p_bonus::HandleProc(), spell_dru_item_t6_trinket::HandleProc(), spell_dru_glyph_of_starfire_dummy::HandleProc(), spell_dru_t9_feral_relic::HandleProc(), spell_gen_moss_covered_feet::HandleProc(), spell_gen_retaliation_toc::HandleProc(), spell_hun_hunting_party::HandleProc(), spell_hun_t9_4p_bonus::HandleProc(), spell_item_unsated_craving::HandleProc(), spell_item_shadowmourne::HandleProc(), spell_item_darkmoon_card_greatness::HandleProc(), spell_item_death_choice::HandleProc(), spell_item_trinket_stack< StackSpell, TriggerSpell >::HandleProc(), spell_item_soul_preserver::HandleProc(), spell_item_mana_drain::HandleProc(), spell_item_aura_of_madness::HandleProc(), spell_item_deathbringers_will_normal::HandleProc(), spell_item_deathbringers_will_heroic::HandleProc(), spell_item_discerning_eye_beast_dummy::HandleProc(), spell_item_healing_touch_refund::HandleProc(), spell_item_heartpierce::HandleProc(), spell_item_heartpierce_hero::HandleProc(), spell_item_mark_of_conquest::HandleProc(), spell_item_sunwell_exalted_caster_neck::HandleProc(), spell_item_sunwell_exalted_melee_neck::HandleProc(), spell_item_sunwell_exalted_tank_neck::HandleProc(), spell_item_swift_hand_justice_dummy::HandleProc(), spell_item_tiny_abomination_in_a_jar::HandleProc(), spell_item_tiny_abomination_in_a_jar_hero::HandleProc(), spell_item_totem_of_flowing_water::HandleProc(), spell_item_purified_shard_of_the_scale::HandleProc(), spell_item_shiny_shard_of_the_scale::HandleProc(), spell_item_living_root_of_the_wildheart::HandleProc(), spell_mage_hot_streak::HandleProc(), spell_mage_imp_blizzard::HandleProc(), spell_pal_item_t6_trinket::HandleProc(), spell_pal_t3_6p_bonus::HandleProc(), spell_pal_heart_of_the_crusader::HandleProc(), spell_pal_improved_lay_of_hands::HandleProc(), spell_pri_item_t6_trinket::HandleProc(), spell_pri_t3_4p_bonus::HandleProc(), spell_rog_deadly_brew::HandleProc(), spell_sha_item_lightning_shield::HandleProc(), spell_sha_item_lightning_shield_trigger::HandleProc(), spell_sha_nature_guardian::HandleProc(), spell_sha_frozen_power::HandleProc(), spell_sha_imp_water_shield::HandleProc(), spell_sha_item_t6_trinket::HandleProc(), spell_sha_lightning_shield::HandleProc(), spell_sha_static_shock::HandleProc(), spell_sha_t3_6p_bonus::HandleProc(), spell_warl_glyph_of_shadowflame::HandleProc(), spell_warl_glyph_of_corruption_nightfall::HandleProc(), spell_warl_seed_of_corruption_dummy::HandleProc(), spell_warl_seed_of_corruption_generic::HandleProc(), spell_warl_soul_leech::HandleProc(), spell_warr_sweeping_strikes::HandleProc(), spell_hun_rapid_recuperation::HandleProc(), spell_mage_burning_determination::HandleProc(), spell_gen_black_bow_of_the_betrayer::HandleProc(), spell_hun_lock_and_load::HandleProc(), spell_item_corpse_tongue_coin::HandleProc(), spell_item_corpse_tongue_coin_heroic::HandleProc(), spell_item_soul_harvesters_charm::HandleProc(), spell_item_petrified_twilight_scale::HandleProc(), spell_item_petrified_twilight_scale_heroic::HandleProc(), spell_mage_gen_extra_effects::HandleProc(), spell_pri_body_and_soul::HandleProcDummy(), AuraEffect::HandleProcTriggerSpellAuraProc(), WorldSession::HandleQuestgiverAcceptQuestOpcode(), AuraEffect::HandleRaidProcFromChargeAuraProc(), spell_dk_raise_dead::HandleRaiseDead(), spell_hun_rapid_recuperation_trigger::HandleRapidKillingProc(), spell_vael_burning_adrenaline::HandleRemove(), spell_kiljaeden_darkness_aura::HandleRemove(), spell_entropius_void_zone_visual_aura::HandleRemove(), spell_igb_rocket_pack_aura::HandleRemove(), spell_najentus_hurl_spine::HandleSchoolDamage(), spell_gen_mine_sweeper::HandleSchoolDMG(), spell_warl_shadowflame::HandleSchoolDMG(), spell_gen_bandage::HandleScript(), spell_gen_translocate::HandleScript(), spell_pal_lay_on_hands::HandleScript(), spell_kormok_summon_bone_mages::HandleScript(), spell_kormok_summon_bone_minions::HandleScript(), spell_energize_aoe::HandleScript(), spell_saviana_conflagration_throwback::HandleScript(), spell_taldaram_glittering_sparks::HandleScript(), spell_blood_queen_bloodbolt::HandleScript(), spell_blood_queen_presence_of_the_darkfallen::HandleScript(), spell_igb_rocket_artillery::HandleScript(), spell_putricide_unstable_experiment::HandleScript(), spell_sindragosa_icy_grip::HandleScript(), spell_the_lich_king_jump::HandleScript(), spell_the_lich_king_summon_spirit_bomb::HandleScript(), spell_dreamwalker_summon_portal::HandleScript(), spell_dreamwalker_twisted_nightmares::HandleScript(), spell_archavon_rock_shards::HandleScript(), spell_wintergrasp_portal::HandleScript(), spell_gen_create_lance::HandleScript(), spell_item_defibrillate::HandleScript(), spell_item_scroll_of_recall::HandleScript(), spell_shazzrah_gate_dummy::HandleScript(), spell_apothecary_lingering_fumes::HandleScript(), spell_apothecary_validate_area::HandleScript(), spell_apothecary_throw_cologne::HandleScript(), spell_apothecary_throw_perfume::HandleScript(), spell_hallows_end_trick::HandleScript(), spell_hallows_end_put_costume::HandleScript(), spell_hallows_end_trick_or_treat::HandleScript(), spell_winter_veil_mistletoe::HandleScript(), spell_ayamiss_swarmer_teleport_trigger::HandleScript(), spell_moam_summon_mana_fiends::HandleScript(), spell_prince_taldaram_conjure_flame_sphere::HandleScript(), spell_mistress_kiss_area::HandleScript(), spell_novos_summon_minions::HandleScript(), spell_festergut_gastric_bloat::HandleScript(), spell_putricide_unbound_plague::HandleScript(), spell_putricide_choking_gas_bomb::HandleScript(), spell_rotface_little_ooze_combine::HandleScript(), spell_rotface_large_ooze_combine::HandleScript(), spell_rotface_large_ooze_buff_combine::HandleScript(), spell_the_lich_king_cast_back_to_caster::HandleScript(), spell_frost_giant_death_plague::HandleScript(), spell_taunt_brann::HandleScript(), spell_vehicle_grab_pyrite::HandleScript(), spell_yogg_saron_target_selectors::HandleScript(), spell_the_cleansing_shrine_cast::HandleScript(), spell_the_cleansing_mirror_image_script_effect::HandleScript(), spell_low_health_trigger::HandleScript(), spell_the_black_stalker_levitate::HandleScript(), spell_the_black_stalker_levitation_pulse::HandleScript(), spell_the_black_stalker_someone_grab_me::HandleScript(), spell_the_black_stalker_magnetic_pull::HandleScript(), spell_the_flag_of_ownership::HandleScript(), spell_gen_elune_candle::HandleScript(), spell_gen_teleporting::HandleScript(), spell_gen_dalaran_disguise::HandleScript(), spell_hun_pet_heart_of_the_phoenix::HandleScript(), spell_item_dimensional_ripper_area52::HandleScript(), spell_item_eggnog::HandleScript(), spell_item_drums_of_forgotten_kings::HandleScript(), spell_item_drums_of_the_wild::HandleScript(), spell_q12805_lifeblood_dummy::HandleScript(), spell_q12735_song_of_cleansing::HandleScript(), spell_q13011_bear_flank_master::HandleScript(), spell_q12619_emblazon_runeblade_effect::HandleScript(), spell_q12919_gymers_throw::HandleScript(), spell_kalecgos_spectral_realm_dummy::HandleScriptEffect(), spell_marrowgar_coldflame_bonestorm::HandleScriptEffect(), spell_yogg_saron_sanity_reduce::HandleScriptEffect(), spell_black_temple_bloodbolt::HandleScriptEffect(), spell_lady_vashj_summon_sporebat::HandleScriptEffect(), spell_kaelthas_summon_weapons::HandleScriptEffect(), spell_kaelthas_gravity_lapse::HandleScriptEffect(), spell_kaelthas_nether_beam::HandleScriptEffect(), spell_gen_clone::HandleScriptEffect(), spell_gen_clone_weapon::HandleScriptEffect(), spell_gen_break_shield::HandleScriptEffect(), spell_gen_mounted_charge::HandleScriptEffect(), spell_gen_throw_shield::HandleScriptEffect(), spell_item_sleepy_willy::HandleScriptEffect(), spell_item_lil_xt::HandleScriptEffect(), spell_q12698_the_gift_that_keeps_on_giving::HandleScriptEffect(), spell_death_knight_initiate_visual::HandleScriptEffect(), spell_summon_amanishi_sentries::HandleScriptEffect(), spell_brewfest_toss_mug::HandleScriptEffect(), spell_direbrew_summon_mole_machine_target_picker::HandleScriptEffect(), spell_request_second_mug::HandleScriptEffect(), spell_winter_veil_racer_slam_hit::HandleScriptEffect(), spell_winter_veil_shoot_air_rifle::HandleScriptEffect(), spell_azjol_drain_power::HandleScriptEffect(), spell_dtk_summon_random_drakkari::HandleScriptEffect(), spell_marrowgar_coldflame::HandleScriptEffect(), spell_gluth_decimate::HandleScriptEffect(), spell_arcane_chains_character_force_cast::HandleScriptEffect(), spell_dragonblight_devour_ghoul::HandleScriptEffect(), spell_hawk_hunting::HandleScriptEffect(), spell_q12611_deathbolt::HandleScriptEffect(), spell_illidari_council_judgement::HandleScriptEffect(), spell_black_temple_summon_shadowfiends::HandleScriptEffect(), spell_ice_bombardment_dest_picker::HandleScriptEffect(), spell_kaelthas_remove_enchanted_weapons::HandleScriptEffect(), spell_kaelthas_kael_explodes::HandleScriptEffect(), spell_q10612_10613_the_fel_and_the_furious::HandleScriptEffect(), spell_dk_pestilence::HandleScriptEffect(), spell_hun_masters_call::HandleScriptEffect(), spell_item_mirrens_drinking_hat::HandleScriptEffect(), spell_pal_judgement::HandleScriptEffect(), spell_pri_lightwell::HandleScriptEffect(), spell_q1846_bending_shinbone::HandleScriptEffect(), spell_q14112_14145_chum_the_water::HandleScriptEffect(), WorldSession::HandleSelfResOpcode(), AuraEffect::HandleShapeshiftBoosts(), ArenaSpectator::HandleSpectatorWatchCommand(), HandleSpellClick(), spell_marrowgar_bone_spike_graveyard::HandleSpikes(), AuraEffect::HandleSpiritOfRedemption(), spell_gen_paralytic_poison::HandleStun(), spell_putricide_mutated_transformation::HandleSummon(), spell_item_draenic_pale_ale::HandleSummon(), WorldSession::HandleTalentWipeConfirmOpcode(), spell_mother_shahraz_fatal_attraction::HandleTeleportUnits(), spell_warl_drain_soul::HandleTick(), spell_trigger_spell_from_caster::HandleTrigger(), spell_magic_eater_food::HandleTriggerSpell(), spell_alert_drums::HandleTriggerSpell(), spell_winter_veil_racer_rocket_slam::HandleTriggerSpell(), spell_pal_righteous_defense::HandleTriggerSpellHit(), boss_onyxia::HandleWhelpSpam(), boss_valithria_dreamwalker::boss_valithria_dreamwalkerAI::HealReceived(), boss_ichoron::boss_ichoronAI::IchoronDoCastToAllHostilePlayers(), spell_q10769_dissension_amongst_the_ranks_aura::if(), CharmInfo::InitCharmCreateSpells(), boss_yoggsaron_sara::InitFight(), npc_jenny::Initialize(), boss_urok_doomhowl::boss_urok_doomhowlAI::InitializeAI(), boss_baltharus_the_warborn::boss_baltharus_the_warbornAI::InitializeAI(), npc_pos_deathwhisper_necrolyte::npc_pos_deathwhisper_necrolyteAI::InitializeAI(), npc_pet_mage_mirror_image::InitializeAI(), npc_pet_pri_lightwell::InitializeAI(), CharmInfo::InitPossessCreateSpells(), Guardian::InitStatsForLevel(), Totem::InitSummon(), boss_faction_championsAI::IsCCed(), npc_living_inferno::npc_living_infernoAI::IsSummonedBy(), TriggerAI::IsSummonedBy(), npc_vaelastrasz_the_red::npc_vaelastrasz_the_redAI::IsSummonedBy(), npc_bone_spike::npc_bone_spikeAI::IsSummonedBy(), npc_strangulate_vehicle::npc_strangulate_vehicleAI::IsSummonedBy(), npc_oculus_drake::npc_oculus_drakeAI::IsSummonedBy(), boss_kologarn_eyebeam::IsSummonedBy(), npc_infra_green_bomber_generic::npc_infra_green_bomber_genericAI::IsSummonedBy(), npc_pet_gen_fetch_ball::IsSummonedBy(), npc_hallows_end_soh::JustDied(), boss_rajaxx::JustDied(), boss_black_knight::boss_black_knightAI::JustDied(), npc_swarm_scarab::npc_swarm_scarabAI::JustDied(), npc_phantom_hallucination::npc_phantom_hallucinationAI::JustDied(), npc_hor_spiritual_reflection::npc_hor_spiritual_reflectionAI::JustDied(), npc_gunship::npc_gunshipAI::JustDied(), boss_professor_putricide::boss_professor_putricideAI::JustDied(), npc_gluttonous_abomination::npc_gluttonous_abominationAI::JustDied(), boss_steelbreaker::JustDied(), boss_runemaster_molgeim::JustDied(), boss_stormcaller_brundir::JustDied(), boss_freya_summons::JustDied(), npc_ulduar_saronite_vapors::JustDied(), boss_yoggsaron_guardian_of_ys::JustDied(), boss_skarvald_the_constructor::JustDied(), boss_dalronn_the_controller::JustDied(), npc_ichor_globule::npc_ichor_globuleAI::JustDied(), boss_fathomguard_sharkkis::JustDied(), boss_fathomguard_tidalvess::JustDied(), boss_fathomguard_caribdis::JustDied(), npc_necropolis_health::JustDied(), npc_necrotic_shard::JustDied(), CombatAI::JustDied(), npc_thrall_old_hillsbrad::npc_thrall_old_hillsbradAI::JustDied(), boss_halion::boss_halionAI::JustDied(), boss_twilight_halion::boss_twilight_halionAI::JustDied(), boss_tharon_ja::boss_tharon_jaAI::JustDied(), boss_sapphiron::boss_sapphironAI::JustDied(), boss_anomalus::JustDied(), npc_nerubar_victim::npc_nerubar_victimAI::JustDied(), boss_shade_of_akama::JustDied(), CasterAI::JustEngagedWith(), boss_servant_quarters::JustEngagedWith(), npc_tapoke_slim_jahn::npc_tapoke_slim_jahnAI::JustEngagedWith(), boss_akilzon::JustEngagedWith(), npc_hallows_end_soh::JustEngagedWith(), boss_sartharion::JustEngagedWith(), boss_eadric::boss_eadricAI::JustEngagedWith(), npc_toc5_grand_champion_minion::npc_toc5_grand_champion_minionAI::JustEngagedWith(), boss_twin_valkyrAI::JustEngagedWith(), boss_garfrost::boss_garfrostAI::JustEngagedWith(), npc_stinky_icc::npc_stinky_iccAI::JustEngagedWith(), npc_high_overlord_saurfang_igb::npc_high_overlord_saurfang_igbAI::JustEngagedWith(), npc_muradin_bronzebeard_igb::npc_muradin_bronzebeard_igbAI::JustEngagedWith(), npc_rimefang::npc_rimefangAI::JustEngagedWith(), npc_nexus_lord::JustEngagedWith(), boss_urom::boss_uromAI::JustEngagedWith(), boss_freya::JustEngagedWith(), boss_freya_summons::JustEngagedWith(), boss_vezax::JustEngagedWith(), boss_hodir::JustEngagedWith(), boss_thorim::JustEngagedWith(), boss_thorim_ancient_rune_giant::JustEngagedWith(), boss_yoggsaron_keeper::JustEngagedWith(), npc_ulduar_storm_tempered_keeper::JustEngagedWith(), boss_koralon::boss_koralonAI::JustEngagedWith(), boss_toravon::boss_toravonAI::JustEngagedWith(), boss_ichoron::boss_ichoronAI::JustEngagedWith(), boss_moragg::boss_moraggAI::JustEngagedWith(), boss_shirrak_the_dead_watcher::JustEngagedWith(), boss_watchkeeper_gargolmar::JustEngagedWith(), boss_gatewatcher_gyrokill::JustEngagedWith(), boss_pathaleon_the_calculator::JustEngagedWith(), npc_pet_shaman_fire_elemental::JustEngagedWith(), CombatAI::JustEngagedWith(), boss_yauj::JustEngagedWith(), boss_moorabi::boss_moorabiAI::JustEngagedWith(), boss_prince_valanar_icc::boss_prince_valanarAI::JustEngagedWith(), boss_blood_queen_lana_thel::boss_blood_queen_lana_thelAI::JustEngagedWith(), boss_lady_deathwhisper::boss_lady_deathwhisperAI::JustEngagedWith(), boss_professor_putricide::boss_professor_putricideAI::JustEngagedWith(), boss_sindragosa::boss_sindragosaAI::JustEngagedWith(), boss_kelthuzad::boss_kelthuzadAI::JustEngagedWith(), boss_sapphiron::boss_sapphironAI::JustEngagedWith(), boss_keristrasza::JustEngagedWith(), boss_steelbreaker::JustEngagedWith(), boss_teron_gorefiend::JustEngagedWith(), boss_fathomlord_karathress::JustEngagedWith(), boss_fathomguard_sharkkis::JustEngagedWith(), npc_artorius::npc_artoriusAI::JustEngagedWith(), npc_simone::npc_simoneAI::JustEngagedWith(), npc_nelson::npc_nelsonAI::JustEngagedWith(), npc_franklin::npc_franklinAI::JustEngagedWith(), boss_baltharus_the_warborn::boss_baltharus_the_warbornAI::JustReachedHome(), boss_bronjahm::boss_bronjahmAI::JustReachedHome(), boss_drakkari_colossus::boss_drakkari_colossusAI::JustReachedHome(), npc_ulduar_iron_construct::JustReachedHome(), boss_freya::JustSummoned(), boss_yoggsaron_brain::JustSummoned(), npc_eris_hevenfire::npc_eris_hevenfireAI::JustSummoned(), boss_skeram::JustSummoned(), boss_ichoron::boss_ichoronAI::JustSummoned(), boss_majordomo::boss_majordomoAI::JustSummoned(), boss_ragnaros::boss_ragnarosAI::JustSummoned(), boss_vexallus::JustSummoned(), boss_kiljaeden::JustSummoned(), npc_kalecgos_kj::JustSummoned(), boss_jindo::JustSummoned(), npc_medivh_bm::JustSummoned(), boss_taldaram::JustSummoned(), boss_baltharus_the_warborn::boss_baltharus_the_warbornAI::JustSummoned(), boss_halion::boss_halionAI::JustSummoned(), boss_gal_darah::JustSummoned(), boss_prince_valanar_icc::boss_prince_valanarAI::JustSummoned(), boss_professor_putricide::boss_professor_putricideAI::JustSummoned(), boss_the_lich_king::boss_the_lich_kingAI::JustSummoned(), npc_icc_putricades_trap::npc_icc_putricades_trapAI::JustSummoned(), boss_malygos::JustSummoned(), boss_algalon_the_observer::JustSummoned(), boss_svala::boss_svalaAI::JustSummoned(), boss_shirrak_the_dead_watcher::JustSummoned(), boss_nexusprince_shaffar::JustSummoned(), boss_grandmaster_vorpil::JustSummoned(), boss_gurtogg_bloodboil::JustSummoned(), boss_veras_darkshadow::JustSummoned(), boss_reliquary_of_souls::boss_reliquary_of_soulsAI::JustSummoned(), boss_supremus::JustSummoned(), boss_hydross_the_unstable::JustSummoned(), boss_lady_vashj::JustSummoned(), npc_pallid_horror::JustSummoned(), npc_lady_sylvanas_windrunner::npc_lady_sylvanas_windrunnerAI::JustSummoned(), boss_archimonde::JustSummoned(), boss_broggok::JustSummoned(), npc_deaths_door_fell_cannon_target_bunny::npc_deaths_door_fell_cannon_target_bunnyAI::JustSummoned(), boss_ayamiss::JustSummoned(), Kill(), boss_azuregos::boss_azuregosAI::KilledUnit(), boss_anubrekhan::KilledUnit(), boss_doomwalker::KilledUnit(), npc_dark_iron_guzzler::KilledUnit(), boss_steelbreaker::KilledUnit(), emerald_dragonAI::KilledUnit(), boss_emeriss::boss_emerissAI::KilledUnit(), boss_felblood_kaelthas::LapseAction(), spell_mandokir_charge::LaunchHit(), Player::learnQuestRewardedSpells(), spell_taldaram_summon_flame_ball::Load(), npc_dkc1_gothik::npc_dkc1_gothikAI::MoveInLineOfSight(), npc_brewfest_keg_thrower::MoveInLineOfSight(), npc_brewfest_keg_reciver::MoveInLineOfSight(), npc_love_in_air_supply_sentry::MoveInLineOfSight(), npc_love_in_air_snivel::MoveInLineOfSight(), boss_temporus::MoveInLineOfSight(), npc_medivh_bm::MoveInLineOfSight(), npc_jenny::MoveInLineOfSight(), npc_guardian_pavilion::npc_guardian_pavilionAI::MoveInLineOfSight(), boss_doomwalker::MoveInLineOfSight(), npc_air_force_bots::npc_air_force_botsAI::MoveInLineOfSight(), npc_spirit_shade::npc_spirit_shadeAI::MovementInform(), npc_unworthy_initiate::npc_unworthy_initiateAI::MovementInform(), boss_grand_champion::boss_grand_championAI::MovementInform(), boss_garfrost::boss_garfrostAI::MovementInform(), boss_eck::MovementInform(), boss_blood_queen_lana_thel::boss_blood_queen_lana_thelAI::MovementInform(), npc_valkyr_shadowguard::npc_valkyr_shadowguardAI::MovementInform(), boss_malygos::MovementInform(), boss_razorscale::MovementInform(), npc_scarlet_ghoul::npc_scarlet_ghoulAI::MovementInform(), boss_headless_horseman::MovementInform(), boss_stormcaller_brundir::MovementInform(), npc_ashtongue_sorcerer::MovementInform(), gunship_npc_AI::MovementInform(), npc_gunship_boarding_addAI::MovementInform(), npc_gunship_mage::npc_gunship_mageAI::MovementInform(), boss_the_lich_king::boss_the_lich_kingAI::MovementInform(), boss_kagani_nightstrike::MovementInform(), npc_dark_iron_guzzler::MovementInform(), npc_hor_lich_king::npc_hor_lich_kingAI::MovementInform(), npc_ball_of_flame::npc_ball_of_flameAI::MovementInform(), npc_assembly_lightning::MovementInform(), boss_ymiron::boss_ymironAI::MovementInform(), boss_icehowl::boss_icehowlAI::MovementInform(), npc_attracted_reef_bull::npc_attracted_reef_bullAI::MovementInform(), npc_image_of_medivh::npc_image_of_medivhAI::NextStep(), BattlegroundAB::NodeOccupied(), npc_alexstrasza::npc_alexstrasza(), npc_algalon_worm_hole::npc_algalon_worm_hole(), npc_ball_of_flame::npc_ball_of_flameAI::npc_ball_of_flameAI(), npc_collapsing_star::npc_collapsing_star(), npc_concentrated_ball::npc_concentrated_ballAI::npc_concentrated_ballAI(), npc_frost_sphere::npc_frost_sphereAI::npc_frost_sphereAI(), npc_frost_tomb::npc_frost_tomb(), npc_hallows_end_soh::npc_hallows_end_soh(), npc_nexus_lord::npc_nexus_lord(), npc_power_spark::npc_power_spark(), npc_scion_of_eternity::npc_scion_of_eternity(), npc_ulduar_iron_construct::npc_ulduar_iron_construct(), npc_ulduar_toasty_fire::npc_ulduar_toasty_fire(), npc_xt002_life_spark::npc_xt002_life_spark(), spell_shadowfang_keep_forsaken_skills_aura::OnApply(), spell_direbrew_disarm::OnApply(), spell_love_is_in_the_air_romantic_picnic::OnApply(), spell_halion_combustion_consumption_aura::OnApply(), spell_load_into_catapult_aura::OnApply(), spell_gen_damage_reduction_aura::OnApply(), spell_gruul_ground_slam_trigger::OnApply(), spell_hun_ascpect_of_the_viper::OnApply(), spell_hun_viper_attack_speed::OnApply(), spell_item_with_mount_speed::OnApply(), spell_item_power_circle::OnAuraInit(), spell_blood_queen_vampiric_bite::OnCast(), npc_chesspiece::OnCharmed(), npc_toc5_player_vehicle::npc_toc5_player_vehicleAI::OnCharmed(), BattlefieldWG::OnCreatureCreate(), instance_halls_of_reflection::instance_halls_of_reflection_InstanceMapScript::OnCreatureCreate(), instance_icecrown_citadel::instance_icecrown_citadel_InstanceMapScript::OnCreatureCreate(), spell_item_linken_boomerang::OnEffectLaunchTargetDisarm(), spell_item_linken_boomerang::OnEffectLaunchTargetStun(), npc_essence_of_twin::OnGossipHello(), npc_alchemist_adrianna::OnGossipHello(), go_manticron_cube::OnGossipHello(), go_seer_of_zebhalak::OnGossipHello(), go_jump_a_tron::OnGossipHello(), go_orb_of_domination::OnGossipHello(), go_scourge_enclosure::OnGossipHello(), go_strange_pool::OnGossipHello(), go_simon_cluster::OnGossipHello(), go_tablet_of_the_seven::OnGossipHello(), go_arcane_prison::OnGossipHello(), go_jotunheim_cage::OnGossipHello(), npc_steward_of_time::OnGossipSelect(), npc_iruk::OnGossipSelect(), npc_zephyr::OnGossipSelect(), npc_taxi::OnGossipSelect(), npc_locksmith::OnGossipSelect(), npc_engineering_tele_trinket::OnGossipSelect(), npc_sayge::OnGossipSelect(), npc_pet_gen_argent_pony_bridle::OnGossipSelect(), npc_lokhtos_darkbargainer::OnGossipSelect(), boss_gloomrel::OnGossipSelect(), npc_death_knight_initiate::OnGossipSelect(), npc_parqual_fintallas::OnGossipSelect(), npcs_riverbreeze_and_silversky::OnGossipSelect(), npc_braug_dimspirit::OnGossipSelect(), npc_avatar_of_freya::OnGossipSelect(), npc_adventurous_dwarf::OnGossipSelect(), npc_wg_demolisher_engineer::OnGossipSelect(), npc_innkeeper::OnGossipSelect(), npc_wormhole::OnGossipSelect(), npc_cos_chromie_start::OnGossipSelect(), icecrown_citadel_teleport::OnGossipSelect(), go_amberpine_outhouse::OnGossipSelect(), go_ancient_skull_pile::OnGossipSelect(), go_fel_crystalforge::OnGossipSelect(), go_bashir_crystalforge::OnGossipSelect(), go_apexis_relic::OnGossipSelect(), Player::OnGossipSelect(), spell_summon_all_players_dummy::OnHit(), spell_apothecary_perfume_spill::OnPeriodic(), spell_apothecary_cologne_spill::OnPeriodic(), spell_muru_summon_blood_elves_periodic_aura::OnPeriodic(), spell_claw_rage_aura::OnPeriodic(), spell_love_is_in_the_air_romantic_picnic::OnPeriodic(), spell_anubisath_mortal_strike::OnPeriodic(), spell_the_lich_king_soul_reaper_aura::OnPeriodic(), spell_yogg_saron_brain_link_aura::OnPeriodic(), spell_yogg_saron_empowered_aura::OnPeriodic(), spell_illidan_tear_of_azzinoth_summon_channel_aura::OnPeriodic(), spell_illidan_demon_transform1_aura::OnPeriodic(), spell_illidan_cage_trap_stun_aura::OnPeriodic(), spell_black_temple_dementia_aura::OnPeriodic(), spell_npc22275_crystal_prison_aura::OnPeriodic(), spell_item_eye_of_grillok_aura::OnPeriodic(), spell_kalecgos_curse_of_boundless_agony_aura::OnPeriodic(), spell_muru_darkness_aura::OnPeriodic(), spell_mark_of_kazrogal_aura::OnPeriodic(), spell_the_lich_king_vile_spirits_aura::OnPeriodic(), spell_web_wrap_damage::OnPeriodic(), spell_assembly_rune_of_summoning_aura::OnPeriodic(), spell_tar_blaze_aura::OnPeriodic(), spell_thorim_lightning_pillar_P2_aura::OnPeriodic(), spell_illidan_demon_transform2_aura::OnPeriodic(), spell_mark_of_kazzak_aura::OnPeriodic(), spell_karathress_power_of_tidalvess::OnPeriodic(), spell_karathress_power_of_caribdis::OnPeriodic(), spell_leotheras_demon_link::OnPeriodic(), spell_lurker_below_spout::OnPeriodic(), spell_gen_periodic_knock_away::OnPeriodic(), spell_gen_turkey_marker::OnPeriodic(), instance_eye_of_eternity::OnPlayerEnter(), instance_culling_of_stratholme::instance_culling_of_stratholme_InstanceMapScript::OnPlayerEnter(), instance_hyjal::instance_mount_hyjal_InstanceMapScript::OnPlayerInWaterStateUpdate(), BattlefieldWG::OnPlayerJoinWar(), lfg::LFGPlayerScript::OnPlayerMapChanged(), MidsummerPlayerScript::OnPlayerUpdateZone(), spell_gen_proc_on_victim::OnProc(), spell_pal_judgements_of_the_just::OnProc(), npc_steward_of_time::OnQuestAccept(), npc_mikhail::OnQuestAccept(), npc_rocknot::OnQuestReward(), npc_thrall_bfu::OnQuestReward(), spell_kalecgos_spectral_realm_aura::OnRemove(), spell_azgalor_doom_aura::OnRemove(), spell_boss_salramm_steal_flesh_aura::OnRemove(), spell_azjol_nerub_web_wrap_aura::OnRemove(), spell_putricide_mutation_init_aura::OnRemove(), spell_the_lich_king_shadow_trap_visual_aura::OnRemove(), spell_the_lich_king_harvest_soul_aura::OnRemove(), spell_icc_web_wrap_aura::OnRemove(), spell_ioc_repair_turret_aura::OnRemove(), spell_malygos_vortex_visual::OnRemove(), spell_dragonblight_devour_ghoul_periodic::OnRemove(), spell_kaelthas_flame_strike::OnRemove(), spell_item_goblin_weather_machine_aura::OnRemove(), spell_q12937_relief_for_the_fallen::OnRemove(), spell_claw_swipe_check::OnRemove(), spell_mage_arcane_missiles::OnRemove(), spell_warl_curse_of_doom::OnRemove(), boss_flame_leviathan_overload_device::OnSpellClick(), boss_yoggsaron_descend_portal::OnSpellClick(), spell_item_shadowmourne_soul_fragment::OnStackChange(), at_hor_battered_hilt_throw::OnTrigger(), at_frozen_throne_teleport::OnTrigger(), AreaTrigger_at_legion_teleporter::OnTrigger(), AreaTrigger_at_stormwright_shelf::OnTrigger(), npc_wintergarde_gryphon::PassengerBoarded(), npc_four_car_garage::npc_four_car_garageAI::PassengerBoarded(), boss_kologarn::PassengerBoarded(), npc_frosthound::PassengerBoarded(), spell_quest_test_flight_charging::PerformKick(), spell_send_mug_control_aura::PeriodicTick(), spell_barreled_control_aura::PeriodicTick(), spell_dreamwalker_summon_suppresser_aura::PeriodicTick(), spell_summon_ice_spear_delayer::PeriodicTick(), spell_summoning_rhyme_aura::PeriodicTick(), spell_pal_beacon_of_light::PeriodicTick(), spell_halion_twilight_phasing::Phase(), BattlegroundAV::PopulateNode(), spell_azjol_nerub_carrion_beetles::PrepareAuraScript(), spell_item_oracle_ablutions::PrepareSpellScript(), spell_q11653_youre_not_so_big_now::PrepareSpellScript(), spell_q13369_fate_up_against_your_will::PrepareSpellScript(), SmartScript::ProcessAction(), ProcessCastaction(), Player::ProcessDelayedOperations(), instance_icecrown_citadel::instance_icecrown_citadel_InstanceMapScript::ProcessEvent(), ProcessTerrainStatusUpdate(), ProcessUnlearnAction(), BattlefieldWG::PromotePlayer(), npc_lake_frog::npc_lake_frogAI::ReceiveEmote(), spell_gen_defend::RefreshVisualShields(), Vehicle::RemovePassenger(), spell_igb_below_zero::RemovePassengers(), boss_keristrasza::RemovePrison(), Player::ReportedAfkBy(), npc_demonic_vapor::Reset(), npc_demonic_vapor_trail::Reset(), npc_batrider::Reset(), npc_dark_iron_guzzler::Reset(), boss_headless_horseman_pumpkin::Reset(), npc_taretha::npc_tarethaAI::Reset(), npc_medivh_bm::Reset(), boss_halion::boss_halionAI::Reset(), npc_swarm_scarab::npc_swarm_scarabAI::Reset(), npc_nerubian_burrower::npc_nerubian_burrowerAI::Reset(), boss_tharon_ja::boss_tharon_jaAI::Reset(), boss_bronjahm::boss_bronjahmAI::Reset(), boss_drakkari_colossus::boss_drakkari_colossusAI::Reset(), boss_drakkari_elemental::boss_drakkari_elementalAI::Reset(), npc_dark_nucleus::npc_dark_nucleusAI::Reset(), boss_lady_deathwhisper::boss_lady_deathwhisperAI::Reset(), boss_sindragosa::boss_sindragosaAI::Reset(), npc_raging_spirit::npc_raging_spiritAI::Reset(), boss_noth::boss_nothAI::Reset(), boss_anomalus::Reset(), npc_oculus_unstable_sphere::npc_oculus_unstable_sphereAI::Reset(), boss_urom::boss_uromAI::Reset(), boss_varos::boss_varosAI::Reset(), boss_algalon_the_observer::Reset(), boss_flame_leviathan::Reset(), npc_thorims_hammer::Reset(), boss_freya_lifebinder::Reset(), boss_freya_healthy_spore::Reset(), boss_freya_nature_bomb::Reset(), boss_thorim_lightning_orb::Reset(), boss_thorim_sif_blizzard::Reset(), boss_thorim_arena_npcs::Reset(), boss_yoggsaron_cloud::Reset(), boss_yoggsaron_immortal_guardian::Reset(), boss_yoggsaron_voice::Reset(), boss_palehoof::boss_palehoofAI::Reset(), npc_frozen_orb::npc_frozen_orbAI::Reset(), npc_frozen_orb_stalker::npc_frozen_orb_stalkerAI::Reset(), npc_injured_7th_legion_soldier::npc_injured_7th_legion_soldierAI::Reset(), npc_brunnhildar_prisoner::npc_brunnhildar_prisonerAI::Reset(), npc_ashtongue_channeler::Reset(), npc_warden_mellichar::npc_warden_mellicharAI::Reset(), boss_wrath_scryer_soccothrates::Reset(), npc_training_dummy::npc_training_dummyAI::Reset(), BfGraveyard::Resurrect(), Resurrect(), Player::ResurrectPlayer(), Player::RewardQuest(), boss_nightbane::ScheduleFly(), boss_the_lurker_below::SchedulerPhaseOne(), Map::ScriptsProcess(), spell_item_mad_alchemists_potion::SecondaryEffect(), spell_item_crazy_alchemists_potion::SecondaryEffect(), npc_icc_ice_sphere::npc_icc_ice_sphereAI::SelectNewTarget(), npc_anubarak_spike::npc_anubarak_spikeAI::SelectNewTarget(), boss_thorim_arena_npcs::SelectT(), npc_sayge::SendAction(), go_skull_pile::SendActionMenu(), npc_xt002_heart::SendEnergyToCorner(), Player::SendInitialPacketsAfterAddToMap(), boss_sartharion::SendLavaWaves(), Player::SendQuestUpdate(), npc_ulduar_harpoonfirestate::SetData(), npc_eastvale_peasent::SetData(), SetModelVisible(), npc_simon_bunny::npc_simon_bunnyAI::SetUpPreGame(), npc_stable_master::npc_stable_masterAI::sGossipSelect(), npc_brewfest_keg_reciver::sGossipSelect(), npc_cairne_bloodhoof::npc_cairne_bloodhoofAI::sGossipSelect(), npc_chesspiece::sGossipSelect(), npc_zafod_boombox::npc_zafod_boomboxAI::sGossipSelect(), npc_crusade_recruit::npc_crusade_recruitAI::sGossipSelect(), npc_cultist_engineer::sGossipSelect(), boss_hodir::SmallIcicles(), boss_skadi_grauf::boss_skadi_graufAI::SpawnFlameTriggers(), boss_malchezaar::SpawnInfernal(), boss_pyroguard_emberseer::boss_pyroguard_emberseerAI::SpellHit(), boss_eadric::boss_eadricAI::SpellHit(), npc_black_knight_ghoul::npc_black_knight_ghoulAI::SpellHit(), npc_cult_fanatic::npc_cult_fanaticAI::SpellHit(), npc_cult_adherent::npc_cult_adherentAI::SpellHit(), boss_valithria_dreamwalker::boss_valithria_dreamwalkerAI::SpellHit(), boss_urom::boss_uromAI::SpellHit(), npc_ulduar_iron_construct::SpellHit(), npc_ulduar_flames_spread::SpellHit(), npc_ichor_globule::npc_ichor_globuleAI::SpellHit(), npc_franklin::npc_franklinAI::SpellHit(), npc_necropolis_relay::SpellHit(), npc_balance_of_light_and_shadow::npc_balance_of_light_and_shadowAI::SpellHit(), npc_dark_iron_guzzler::SpellHit(), boss_headless_horseman::SpellHit(), npc_pool_of_tar::SpellHit(), boss_thorim_pillar::SpellHit(), npc_necropolis_proxy::SpellHit(), npc_aged_dying_ancient_kodo::SpellHit(), boss_jaraxxus::boss_jaraxxusAI::SpellHit(), npc_living_constellation::SpellHit(), boss_ignis::SpellHit(), boss_razorscale::SpellHit(), npc_brunnhildar_prisoner::npc_brunnhildar_prisonerAI::SpellHit(), npc_necrotic_shard::SpellHit(), npc_soh_fire_trigger::SpellHit(), boss_headless_horseman_head::SpellHit(), boss_magus_telestra::SpellHit(), boss_thorim::SpellHit(), npc_iron_watcher::npc_iron_watcherAI::SpellHit(), boss_black_knight::boss_black_knightAI::SpellHitTarget(), boss_bronjahm::boss_bronjahmAI::SpellHitTarget(), boss_felmyst::SpellHitTarget(), boss_devourer_of_souls::boss_devourer_of_soulsAI::SpellHitTarget(), boss_rotface::boss_rotfaceAI::SpellHitTarget(), npc_icc_valkyr_herald::npc_icc_valkyr_heraldAI::SpellHitTarget(), boss_hodir::SpellHitTarget(), npc_ulduar_rocket_strike_trigger::SpellHitTarget(), npc_q24545_lich_king::npc_q24545_lich_kingAI::SpellHitTarget(), npc_chesspiece::SpellHitTarget(), boss_epoch::boss_epochAI::SpellHitTarget(), boss_sapphiron::boss_sapphironAI::SpellHitTarget(), boss_skadi_grauf::boss_skadi_graufAI::SpellHitTarget(), npc_overlord_drakuru_betrayal::SpellHitTarget(), boss_shirrak_the_dead_watcher::SpellHitTarget(), npc_pet_gen_soul_trader_beacon::SpellHitTarget(), Battleground::SpiritOfCompetitionEvent(), boss_heigan::StartFightPhase(), npc_finklestein::npc_finklesteinAI::StartNextTask(), spell_dk_ghoul_explode::Suicide(), boss_anzu::SummonBroods(), boss_cthun::SummonedCreatureDies(), boss_anubrekhan::SummonedCreatureDies(), boss_vexallus::SummonedCreatureDies(), boss_sartharion::SummonLavaWaves(), boss_paletress::boss_paletressAI::SummonMemory(), go_wind_stone::go_wind_stoneAI::SummonNPC(), Trainer::Trainer::TeachSpell(), spell_igb_check_for_players::TeleportPlayer(), BattlegroundSA::TeleportToEntrancePosition(), spell_midsummer_fling_torch::ThrowNextTorch(), TriggerBurningPitch(), npc_orb_carrier::npc_orb_carrierAI::TriggerCutter(), spell_koralon_meteor_fists_aura::TriggerFists(), spell_flame_warder_meteor_fists_aura::TriggerFists(), spell_gen_holiday_buff_food::TriggerFoodBuff(), spell_mage_ice_block::TriggerHypothermia(), spell_item_brewfest_hops::Update(), spell_karazhan_brittle_bones_aura::Update(), spell_black_temple_curse_of_the_bleakheart_aura::Update(), spell_illidari_council_deadly_strike_aura::Update(), spell_mother_shahraz_random_periodic_aura::Update(), spell_mother_shahraz_beam_periodic_aura::Update(), spell_mother_shahraz_saber_lash_aura::Update(), spell_black_temple_charge_rage_aura::Update(), Pet::Update(), GameObject::Update(), TotemAI::UpdateAI(), boss_pyroguard_emberseer::boss_pyroguard_emberseerAI::UpdateAI(), npc_vaelastrasz_the_red::npc_vaelastrasz_the_redAI::UpdateAI(), boss_vaelastrasz::boss_vaelAI::UpdateAI(), boss_ragnaros::boss_ragnarosAI::UpdateAI(), boss_mr_smite::boss_mr_smiteAI::UpdateAI(), npc_image_of_medivh::npc_image_of_medivhAI::UpdateAI(), npc_death_knight_initiate::npc_death_knight_initiateAI::UpdateAI(), npc_scarlet_ghoul::npc_scarlet_ghoulAI::UpdateAI(), npc_highlord_darion_mograine::npc_highlord_darion_mograineAI::UpdateAI(), boss_kirtonos_the_herald::boss_kirtonos_the_heraldAI::UpdateAI(), npc_scholomance_occultist::npc_scholomance_occultistAI::UpdateAI(), npc_madrigosa::UpdateAI(), npc_demonic_vapor::UpdateAI(), npc_demonic_vapor_trail::UpdateAI(), npc_kalecgos_kj::UpdateAI(), npc_balance_of_light_and_shadow::npc_balance_of_light_and_shadowAI::UpdateAI(), npc_partygoer::UpdateAI(), npc_bh_thalorien_dawnseeker::npc_bh_thalorien_dawnseekerAI::UpdateAI(), npc_thrall_bfu::npc_thrall_bfuAI::UpdateAI(), boss_wushoolay::boss_wushoolayAI::UpdateAI(), npc_dark_iron_guzzler::UpdateAI(), npc_brewfest_super_brew_trigger::UpdateAI(), npc_hallows_end_train_fire::UpdateAI(), boss_headless_horseman::UpdateAI(), boss_headless_horseman_head::UpdateAI(), boss_headless_horseman_pumpkin::UpdateAI(), npc_love_in_air_snivel_real::UpdateAI(), boss_epoch::boss_epochAI::UpdateAI(), boss_infinite_corruptor::boss_infinite_corruptorAI::UpdateAI(), boss_mal_ganis::boss_mal_ganisAI::UpdateAI(), boss_meathook::boss_meathookAI::UpdateAI(), boss_salramm::boss_salrammAI::UpdateAI(), npc_arthas::npc_arthasAI::UpdateAI(), npc_thrall_old_hillsbrad::npc_thrall_old_hillsbradAI::UpdateAI(), npc_medivh_bm::UpdateAI(), npc_time_rift::UpdateAI(), boss_onyxia::UpdateAI(), boss_skeram::UpdateAI(), npc_murkdeep::npc_murkdeepAI::UpdateAI(), npc_tharnarian::npc_tharnarianAI::UpdateAI(), boss_baltharus_the_warborn::boss_baltharus_the_warbornAI::UpdateAI(), npc_baltharus_the_warborn_clone::npc_baltharus_the_warborn_cloneAI::UpdateAI(), boss_general_zarithrian::boss_general_zarithrianAI::UpdateAI(), boss_halion::boss_halionAI::UpdateAI(), boss_twilight_halion::boss_twilight_halionAI::UpdateAI(), npc_halion_controller::npc_halion_controllerAI::UpdateAI(), boss_saviana_ragefire::boss_saviana_ragefireAI::UpdateAI(), boss_eadric::boss_eadricAI::UpdateAI(), boss_paletress::boss_paletressAI::UpdateAI(), npc_memory::npc_memoryAI::UpdateAI(), npc_argent_soldier::npc_argent_soldierAI::UpdateAI(), boss_black_knight::boss_black_knightAI::UpdateAI(), npc_black_knight_ghoul::npc_black_knight_ghoulAI::UpdateAI(), npc_toc5_grand_champion_minion::npc_toc5_grand_champion_minionAI::UpdateAI(), boss_grand_champion::boss_grand_championAI::UpdateAI(), boss_anubarak_trial::boss_anubarak_trialAI::UpdateAI(), npc_swarm_scarab::npc_swarm_scarabAI::UpdateAI(), npc_frost_sphere::npc_frost_sphereAI::UpdateAI(), npc_nerubian_burrower::npc_nerubian_burrowerAI::UpdateAI(), npc_anubarak_spike::npc_anubarak_spikeAI::UpdateAI(), npc_toc_druid::npc_toc_druidAI::UpdateAI(), npc_toc_shaman::npc_toc_shamanAI::UpdateAI(), npc_toc_paladin::npc_toc_paladinAI::UpdateAI(), npc_toc_priest::npc_toc_priestAI::UpdateAI(), npc_toc_shadow_priest::npc_toc_shadow_priestAI::UpdateAI(), npc_toc_warlock::npc_toc_warlockAI::UpdateAI(), npc_toc_mage::npc_toc_mageAI::UpdateAI(), npc_toc_hunter::npc_toc_hunterAI::UpdateAI(), npc_toc_boomkin::npc_toc_boomkinAI::UpdateAI(), npc_toc_warrior::npc_toc_warriorAI::UpdateAI(), npc_toc_dk::npc_toc_dkAI::UpdateAI(), npc_toc_rogue::npc_toc_rogueAI::UpdateAI(), npc_toc_enh_shaman::npc_toc_enh_shamanAI::UpdateAI(), npc_toc_retro_paladin::npc_toc_retro_paladinAI::UpdateAI(), npc_toc_pet_warlock::npc_toc_pet_warlockAI::UpdateAI(), npc_toc_pet_hunter::npc_toc_pet_hunterAI::UpdateAI(), boss_jaraxxus::boss_jaraxxusAI::UpdateAI(), npc_fel_infernal::npc_fel_infernalAI::UpdateAI(), npc_mistress_of_pain::npc_mistress_of_painAI::UpdateAI(), npc_snobold_vassal::npc_snobold_vassalAI::UpdateAI(), boss_gormok::boss_gormokAI::UpdateAI(), boss_jormungarAI::UpdateAI(), boss_icehowl::boss_icehowlAI::UpdateAI(), boss_twin_valkyrAI::UpdateAI(), boss_tharon_ja::boss_tharon_jaAI::UpdateAI(), boss_trollgore::boss_trollgoreAI::UpdateAI(), boss_bronjahm::boss_bronjahmAI::UpdateAI(), npc_fos_corrupted_soul_fragment::npc_fos_corrupted_soul_fragmentAI::UpdateAI(), boss_devourer_of_souls::boss_devourer_of_soulsAI::UpdateAI(), boss_falric::boss_falricAI::UpdateAI(), boss_marwyn::boss_marwynAI::UpdateAI(), npc_hor_leader::npc_hor_leaderAI::UpdateAI(), npc_ghostly_priest::npc_ghostly_priestAI::UpdateAI(), npc_phantom_mage::npc_phantom_mageAI::UpdateAI(), npc_shadowy_mercenary::npc_shadowy_mercenaryAI::UpdateAI(), npc_spectral_footman::npc_spectral_footmanAI::UpdateAI(), npc_tortured_rifleman::npc_tortured_riflemanAI::UpdateAI(), boss_frostsworn_general::boss_frostsworn_generalAI::UpdateAI(), npc_hor_spiritual_reflection::npc_hor_spiritual_reflectionAI::UpdateAI(), npc_hor_lich_king::npc_hor_lich_kingAI::UpdateAI(), npc_hor_leader_second::npc_hor_leader_secondAI::UpdateAI(), npc_hor_risen_witch_doctor::npc_hor_risen_witch_doctorAI::UpdateAI(), npc_hor_lumbering_abomination::npc_hor_lumbering_abominationAI::UpdateAI(), boss_garfrost::boss_garfrostAI::UpdateAI(), boss_ick::boss_ickAI::UpdateAI(), boss_krick::boss_krickAI::UpdateAI(), boss_tyrannus::boss_tyrannusAI::UpdateAI(), npc_pos_leader::npc_pos_leaderAI::UpdateAI(), npc_pos_deathwhisper_necrolyte::npc_pos_deathwhisper_necrolyteAI::UpdateAI(), npc_pos_icicle_trigger::npc_pos_icicle_triggerAI::UpdateAI(), npc_pos_collapsing_icicle::npc_pos_collapsing_icicleAI::UpdateAI(), npc_pos_leader_second::npc_pos_leader_secondAI::UpdateAI(), boss_drakkari_colossus::boss_drakkari_colossusAI::UpdateAI(), boss_drakkari_elemental::boss_drakkari_elementalAI::UpdateAI(), npc_living_mojo::npc_living_mojoAI::UpdateAI(), boss_moorabi::boss_moorabiAI::UpdateAI(), boss_prince_keleseth_icc::boss_prince_kelesethAI::UpdateAI(), boss_prince_taldaram_icc::boss_prince_taldaramAI::UpdateAI(), boss_prince_valanar_icc::boss_prince_valanarAI::UpdateAI(), npc_dark_nucleus::npc_dark_nucleusAI::UpdateAI(), boss_blood_queen_lana_thel::boss_blood_queen_lana_thelAI::UpdateAI(), boss_deathbringer_saurfang::boss_deathbringer_saurfangAI::UpdateAI(), boss_festergut::boss_festergutAI::UpdateAI(), npc_stinky_icc::npc_stinky_iccAI::UpdateAI(), npc_high_overlord_saurfang_igb::npc_high_overlord_saurfang_igbAI::UpdateAI(), npc_muradin_bronzebeard_igb::npc_muradin_bronzebeard_igbAI::UpdateAI(), npc_gunship_boarding_leader::npc_gunship_boarding_leaderAI::UpdateAI(), boss_lady_deathwhisper::boss_lady_deathwhisperAI::UpdateAI(), npc_cult_fanatic::npc_cult_fanaticAI::UpdateAI(), npc_cult_adherent::npc_cult_adherentAI::UpdateAI(), npc_darnavan::npc_darnavanAI::UpdateAI(), boss_lord_marrowgar::UpdateAI(), npc_coldflame::npc_coldflameAI::UpdateAI(), boss_professor_putricide::boss_professor_putricideAI::UpdateAI(), boss_rotface::boss_rotfaceAI::UpdateAI(), npc_little_ooze::npc_little_oozeAI::UpdateAI(), npc_big_ooze::npc_big_oozeAI::UpdateAI(), npc_precious_icc::npc_precious_iccAI::UpdateAI(), boss_sindragosa::boss_sindragosaAI::UpdateAI(), npc_spinestalker::npc_spinestalkerAI::UpdateAI(), npc_rimefang::npc_rimefangAI::UpdateAI(), npc_sindragosa_trash::npc_sindragosa_trashAI::UpdateAI(), boss_the_lich_king::boss_the_lich_kingAI::UpdateAI(), npc_tirion_fordring_tft::npc_tirion_fordringAI::UpdateAI(), npc_shambling_horror_icc::npc_shambling_horror_iccAI::UpdateAI(), npc_raging_spirit::npc_raging_spiritAI::UpdateAI(), npc_valkyr_shadowguard::npc_valkyr_shadowguardAI::UpdateAI(), npc_terenas_menethil::npc_terenas_menethilAI::UpdateAI(), npc_spirit_warden::npc_spirit_wardenAI::UpdateAI(), npc_lk_spirit_bomb::npc_lk_spirit_bombAI::UpdateAI(), boss_valithria_dreamwalker::boss_valithria_dreamwalkerAI::UpdateAI(), npc_the_lich_king_controller::npc_the_lich_king_controllerAI::UpdateAI(), npc_risen_archmage::npc_risen_archmageAI::UpdateAI(), npc_valithria_cloud::npc_valithria_cloudAI::UpdateAI(), npc_blazing_skeleton::npc_blazing_skeletonAI::UpdateAI(), npc_gluttonous_abomination::npc_gluttonous_abominationAI::UpdateAI(), boss_sister_svalna::boss_sister_svalnaAI::UpdateAI(), npc_frostwing_vrykul::npc_frostwing_vrykulAI::UpdateAI(), npc_icc_skybreaker_hierophant::npc_icc_skybreaker_hierophantAI::UpdateAI(), npc_icc_skybreaker_marksman::npc_icc_skybreaker_marksmanAI::UpdateAI(), npc_icc_skybreaker_vicar::npc_icc_skybreaker_vicarAI::UpdateAI(), npc_icc_skybreaker_luminary::npc_icc_skybreaker_luminaryAI::UpdateAI(), npc_icc_valkyr_herald::npc_icc_valkyr_heraldAI::UpdateAI(), npc_icc_severed_essence::npc_icc_severed_essenceAI::UpdateAI(), npc_icc_vengeful_fleshreaper::npc_icc_vengeful_fleshreaperAI::UpdateAI(), npc_icc_nerubar_broodkeeper::npc_icc_nerubar_broodkeeperAI::UpdateAI(), boss_isle_of_conquest::boss_isle_of_conquestAI::UpdateAI(), boss_four_horsemen::boss_four_horsemenAI::UpdateAI(), boss_gluth::boss_gluthAI::UpdateAI(), boss_gothik::boss_gothikAI::UpdateAI(), npc_boss_gothik_minion::npc_boss_gothik_minionAI::UpdateAI(), boss_grobbulus::boss_grobbulusAI::UpdateAI(), boss_grobbulus_poison_cloud::boss_grobbulus_poison_cloudAI::UpdateAI(), boss_kelthuzad::boss_kelthuzadAI::UpdateAI(), boss_kelthuzad_minion::boss_kelthuzad_minionAI::UpdateAI(), boss_loatheb::boss_loathebAI::UpdateAI(), boss_maexxna::boss_maexxnaAI::UpdateAI(), boss_noth::boss_nothAI::UpdateAI(), boss_patchwerk::boss_patchwerkAI::UpdateAI(), boss_sapphiron::boss_sapphironAI::UpdateAI(), boss_thaddius::boss_thaddiusAI::UpdateAI(), boss_thaddius_summon::boss_thaddius_summonAI::UpdateAI(), boss_malygos::UpdateAI(), npc_power_spark::UpdateAI(), boss_anomalus::UpdateAI(), boss_keristrasza::UpdateAI(), boss_magus_telestra::UpdateAI(), boss_ormorok::UpdateAI(), npc_crystal_spike::UpdateAI(), boss_drakos::boss_drakosAI::UpdateAI(), npc_oculus_unstable_sphere::npc_oculus_unstable_sphereAI::UpdateAI(), boss_eregos::boss_eregosAI::UpdateAI(), boss_urom::boss_uromAI::UpdateAI(), boss_varos::boss_varosAI::UpdateAI(), npc_stormforged_lieutenant::UpdateAI(), boss_krystallus::boss_krystallusAI::UpdateAI(), boss_maiden_of_grief::boss_maiden_of_griefAI::UpdateAI(), boss_sjonnir_iron_sludge::boss_sjonnir_iron_sludgeAI::UpdateAI(), boss_algalon_the_observer::UpdateAI(), npc_algalon_worm_hole::UpdateAI(), boss_steelbreaker::UpdateAI(), boss_runemaster_molgeim::UpdateAI(), boss_stormcaller_brundir::UpdateAI(), npc_auriaya_sanctum_sentry::UpdateAI(), boss_flame_leviathan::UpdateAI(), npc_freya_ward::UpdateAI(), boss_freya::UpdateAI(), boss_freya_elder_stonebark::UpdateAI(), boss_freya_elder_brightleaf::UpdateAI(), boss_freya_elder_ironbranch::UpdateAI(), boss_freya_lifebinder::UpdateAI(), boss_freya_summons::UpdateAI(), boss_freya_nature_bomb::UpdateAI(), boss_vezax::UpdateAI(), npc_ulduar_saronite_animus::UpdateAI(), boss_hodir::UpdateAI(), npc_ulduar_icicle::UpdateAI(), npc_ulduar_hodir_priest::UpdateAI(), npc_ulduar_hodir_druid::UpdateAI(), npc_ulduar_hodir_shaman::UpdateAI(), npc_ulduar_hodir_mage::UpdateAI(), npc_ulduar_iron_construct::UpdateAI(), boss_ignis::UpdateAI(), boss_kologarn::UpdateAI(), boss_kologarn_eyebeam::UpdateAI(), boss_mimiron::UpdateAI(), npc_ulduar_leviathan_mkii::UpdateAI(), npc_ulduar_vx001::UpdateAI(), npc_ulduar_aerial_command_unit::UpdateAI(), npc_ulduar_proximity_mine::UpdateAI(), npc_ulduar_emergency_fire_bot::UpdateAI(), boss_razorscale::UpdateAI(), npc_ulduar_dark_rune_guardian::UpdateAI(), npc_ulduar_dark_rune_watcher::UpdateAI(), npc_ulduar_dark_rune_sentinel::UpdateAI(), boss_thorim::UpdateAI(), boss_thorim_sif::UpdateAI(), boss_thorim_trap::UpdateAI(), boss_thorim_start_npcs::UpdateAI(), boss_thorim_gauntlet_npcs::UpdateAI(), boss_thorim_runic_colossus::UpdateAI(), boss_thorim_ancient_rune_giant::UpdateAI(), boss_thorim_arena_npcs::UpdateAI(), boss_xt002::UpdateAI(), npc_xt002_pummeller::UpdateAI(), boss_yoggsaron_sara::UpdateAI(), boss_yoggsaron_guardian_of_ys::UpdateAI(), boss_yoggsaron::UpdateAI(), boss_yoggsaron_death_orb::UpdateAI(), boss_yoggsaron_immortal_guardian::UpdateAI(), npc_ulduar_storm_tempered_keeper::UpdateAI(), npc_ulduar_arachnopod_destroyer::UpdateAI(), boss_ingvar_the_plunderer::UpdateAI(), npc_vrykul_skeleton::UpdateAI(), boss_skarvald_the_constructor::UpdateAI(), boss_dalronn_the_controller::UpdateAI(), boss_palehoof::boss_palehoofAI::UpdateAI(), npc_massive_jormungar::npc_massive_jormungarAI::UpdateAI(), npc_ferocious_rhino::npc_ferocious_rhinoAI::UpdateAI(), npc_ravenous_furbolg::npc_ravenous_furbolgAI::UpdateAI(), npc_frenzied_worgen::npc_frenzied_worgenAI::UpdateAI(), boss_skadi::boss_skadiAI::UpdateAI(), boss_skadi_grauf::boss_skadi_graufAI::UpdateAI(), boss_svala::boss_svalaAI::UpdateAI(), boss_ymiron::boss_ymironAI::UpdateAI(), boss_emalon::boss_emalonAI::UpdateAI(), boss_koralon::boss_koralonAI::UpdateAI(), boss_toravon::boss_toravonAI::UpdateAI(), boss_cyanigosa::boss_cyanigosaAI::UpdateAI(), boss_erekem::boss_erekemAI::UpdateAI(), npc_erekem_guard::npc_erekem_guardAI::UpdateAI(), boss_lavanthor::boss_lavanthorAI::UpdateAI(), boss_moragg::boss_moraggAI::UpdateAI(), boss_xevozz::boss_xevozzAI::UpdateAI(), boss_zuramat::boss_zuramatAI::UpdateAI(), npc_vh_teleportation_portal::npc_vh_teleportation_portalAI::UpdateAI(), npc_azure_saboteur::npc_azure_saboteurAI::UpdateAI(), npc_conversing_with_the_depths_trigger::npc_conversing_with_the_depths_triggerAI::UpdateAI(), npc_hourglass_of_eternity::npc_hourglass_of_eternityAI::UpdateAI(), npc_q24545_lich_king::npc_q24545_lich_kingAI::UpdateAI(), npc_q24545_vegard::npc_q24545_vegardAI::UpdateAI(), npc_wounded_skirmisher::UpdateAI(), npc_lord_arete::npc_lord_areteAI::UpdateAI(), npc_jungle_punch_target::npc_jungle_punch_targetAI::UpdateAI(), npc_iron_watcher::npc_iron_watcherAI::UpdateAI(), npc_freed_protodrake::npc_freed_protodrakeAI::UpdateAI(), npc_wg_queue::npc_wg_queueAI::UpdateAI(), boss_gathios_the_shatterer::UpdateAI(), boss_lady_malande::UpdateAI(), boss_the_lurker_below::UpdateAI(), npc_millhouse_manastorm::npc_millhouse_manastormAI::UpdateAI(), npc_warden_mellichar::npc_warden_mellicharAI::UpdateAI(), npc_invis_infernal_caster::npc_invis_infernal_casterAI::UpdateAI(), npc_dragonmaw_peon::npc_dragonmaw_peonAI::UpdateAI(), npc_pet_gen_soul_trader_beacon::UpdateAI(), npc_pet_gen_argent_pony_bridle::UpdateAI(), npc_pet_gen_target_following_bomb::UpdateAI(), npc_pet_hunter_snake_trap::UpdateAI(), npc_pet_mage_mirror_image::UpdateAI(), npc_pet_shaman_fire_elemental::UpdateAI(), trigger_periodic::trigger_periodicAI::UpdateAI(), npc_artorius::npc_artoriusAI::UpdateAI(), npc_simone::npc_simoneAI::UpdateAI(), npc_nelson::npc_nelsonAI::UpdateAI(), npc_franklin::npc_franklinAI::UpdateAI(), boss_ichoron::boss_ichoronAI::UpdateAI(), npc_orb_carrier::npc_orb_carrierAI::UpdateAI(), npc_hor_raging_ghoul::npc_hor_raging_ghoulAI::UpdateAI(), npc_gunship_rocketeer::npc_gunship_rocketeerAI::UpdateAI(), npc_suppresser::npc_suppresserAI::UpdateAI(), boss_maexxna_webwrap::boss_maexxna_webwrapAI::UpdateAI(), npc_living_poison::UpdateAI(), npc_xt002_life_spark::UpdateAI(), boss_yoggsaron_crusher_tentacle::UpdateAI(), boss_yoggsaron_corruptor_tentacle::UpdateAI(), npc_q24545_vegard_dummy::npc_q24545_vegard_dummyAI::UpdateAI(), Player::UpdateAreaDependentAuras(), Player::UpdateCharmedAI(), npc_thrall_old_hillsbrad::npc_thrall_old_hillsbradAI::UpdateEscortAI(), brann_bronzebeard::brann_bronzebeardAI::UpdateEscortAI(), boss_yoggsaron_cloud::UpdateEscortAI(), npc_tirions_gambit_tirion::npc_tirions_gambit_tirionAI::UpdateEscortAI(), npc_isla_starmane::npc_isla_starmaneAI::UpdateEscortAI(), boss_stormcaller_brundir::UpdatePhase(), Player::UpdateZoneDependentAuras(), GameObject::Use(), Player::VehicleSpellInitialize(), npc_arthas::npc_arthasAI::WaypointReached(), and npc_engineer_helice::npc_engineer_heliceAI::WaypointReached().

◆ CastSpell() [4/7]

SpellCastResult Unit::CastSpell ( Unit victim,
SpellInfo const *  spellInfo,
bool  triggered,
Item castItem = nullptr,
AuraEffect const *  triggeredByAura = nullptr,
ObjectGuid  originalCaster = ObjectGuid::Empty 
)
1348{
1349 return CastSpell(victim, spellInfo, triggered ? TRIGGERED_FULL_MASK : TRIGGERED_NONE, castItem, triggeredByAura, originalCaster);
1350}

References CastSpell(), TRIGGERED_FULL_MASK, and TRIGGERED_NONE.

◆ CastSpell() [5/7]

SpellCastResult Unit::CastSpell ( Unit victim,
SpellInfo const *  spellInfo,
TriggerCastFlags  triggerFlags = TRIGGERED_NONE,
Item castItem = nullptr,
AuraEffect const *  triggeredByAura = nullptr,
ObjectGuid  originalCaster = ObjectGuid::Empty 
)
1353{
1354 SpellCastTargets targets;
1355 targets.SetUnitTarget(victim);
1356 return CastSpell(targets, spellInfo, nullptr, triggerFlags, castItem, triggeredByAura, originalCaster);
1357}

References CastSpell(), and SpellCastTargets::SetUnitTarget().

◆ CastSpell() [6/7]

SpellCastResult Unit::CastSpell ( Unit victim,
uint32  spellId,
bool  triggered,
Item castItem = nullptr,
AuraEffect const *  triggeredByAura = nullptr,
ObjectGuid  originalCaster = ObjectGuid::Empty 
)
1331{
1332 return CastSpell(victim, spellId, triggered ? TRIGGERED_FULL_MASK : TRIGGERED_NONE, castItem, triggeredByAura, originalCaster);
1333}

References CastSpell(), TRIGGERED_FULL_MASK, and TRIGGERED_NONE.

◆ CastSpell() [7/7]

SpellCastResult Unit::CastSpell ( Unit victim,
uint32  spellId,
TriggerCastFlags  triggerFlags = TRIGGERED_NONE,
Item castItem = nullptr,
AuraEffect const *  triggeredByAura = nullptr,
ObjectGuid  originalCaster = ObjectGuid::Empty 
)
1336{
1337 SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId);
1338 if (!spellInfo)
1339 {
1340 LOG_ERROR("entities.unit", "CastSpell: unknown spell {} by caster {}", spellId, GetGUID().ToString());
1342 }
1343
1344 return CastSpell(victim, spellInfo, triggerFlags, castItem, triggeredByAura, originalCaster);
1345}

References CastSpell(), Object::GetGUID(), LOG_ERROR, SPELL_FAILED_SPELL_UNAVAILABLE, sSpellMgr, and Position::ToString().

◆ CastStop()

◆ ChangeSeat()

void Unit::ChangeSeat ( int8  seatId,
bool  next = true 
)
15814{
15815 if (!m_vehicle)
15816 return;
15817
15818 if (seatId < 0)
15819 {
15820 seatId = m_vehicle->GetNextEmptySeat(GetTransSeat(), next);
15821 if (seatId < 0)
15822 return;
15823 }
15824 else if (seatId == GetTransSeat() || !m_vehicle->HasEmptySeat(seatId))
15825 return;
15826
15828 if (!m_vehicle->AddPassenger(this, seatId))
15829 ABORT();
15830}
int8 GetNextEmptySeat(int8 seatId, bool next) const
Definition Vehicle.cpp:247
bool HasEmptySeat(int8 seatId) const
Definition Vehicle.cpp:221

References ABORT, Vehicle::AddPassenger(), Vehicle::GetNextEmptySeat(), WorldObject::GetTransSeat(), Vehicle::HasEmptySeat(), m_vehicle, and Vehicle::RemovePassenger().

Referenced by _EnterVehicle(), and WorldSession::HandleChangeSeatsOnControlledVehicle().

◆ CheckAttackFitToAuraRequirement()

virtual bool Unit::CheckAttackFitToAuraRequirement ( WeaponAttackType  ,
AuraEffect const *   
) const
inlinevirtual

Reimplemented in Player.

1076{ return true; }

Referenced by UpdateDamageDoneMods(), UpdateDamagePctDoneMods(), and Player::UpdateWeaponDependentCritAuras().

◆ CleanupBeforeRemoveFromMap()

void Unit::CleanupBeforeRemoveFromMap ( bool  finalCleanup)
12739{
12741 return;
12742
12743 // This needs to be before RemoveFromWorld to make GetCaster() return a valid pointer on aura removal
12745
12746 if (IsInWorld()) // not in world and not being removed atm
12748
12749 ASSERT(GetGUID());
12750
12751 // A unit may be in removelist and not in world, but it is still in grid
12752 // and may have some references during delete
12755
12756 if (finalCleanup)
12757 m_cleanupDone = true;
12758
12759 CombatStop();
12764 GetMotionMaster()->Clear(false); // remove different non-standard movement generators.
12765}
void deleteReferences(bool removeFromMap=false)
Definition HostileRefMgr.cpp:125
void Clear(bool reset=true)
Definition MotionMaster.h:192
void ClearAllThreat()
Definition ThreatMgr.cpp:485
void CombatStop(bool includingCast=false)
Definition Unit.cpp:7425
void RemoveAllGameObjects()
Definition Unit.cpp:6596
void ClearComboPoints()
Definition Unit.cpp:13366
void ClearComboPointHolders()
Definition Unit.cpp:13421
HostileRefMgr & getHostileRefMgr()
Definition Unit.h:951
void RemoveFromWorld() override
Definition Unit.cpp:12692
void RemoveAllAuras()
Definition Unit.cpp:5544
ThreatMgr & GetThreatMgr()
Definition Unit.h:947

References ASSERT, MotionMaster::Clear(), ThreatMgr::ClearAllThreat(), ClearComboPointHolders(), ClearComboPoints(), CombatStop(), HostileRefMgr::deleteReferences(), Object::GetGUID(), getHostileRefMgr(), GetMotionMaster(), GetThreatMgr(), InterruptNonMeleeSpells(), IsDuringRemoveFromWorld(), Object::IsInWorld(), m_cleanupDone, RemoveAllAuras(), RemoveAllGameObjects(), and RemoveFromWorld().

Referenced by CleanupsBeforeDelete().

◆ CleanupsBeforeDelete()

void Unit::CleanupsBeforeDelete ( bool  finalCleanup = true)
overridevirtual

Reimplemented from WorldObject.

12768{
12769 if (GetTransport())
12770 {
12772 SetTransport(nullptr);
12775 }
12776
12777 CleanupBeforeRemoveFromMap(finalCleanup);
12778}
virtual void RemovePassenger(WorldObject *passenger, bool withAll=false)=0
void CleanupBeforeRemoveFromMap(bool finalCleanup)
Definition Unit.cpp:12738
void SetTransport(Transport *t)
Definition Object.h:691
void Reset()
Definition Object.h:298
void RemoveMovementFlag(uint32 flag)
Definition Object.h:344

References CleanupBeforeRemoveFromMap(), WorldObject::GetTransport(), WorldObject::m_movementInfo, MOVEMENTFLAG_ONTRANSPORT, MovementInfo::RemoveMovementFlag(), Transport::RemovePassenger(), MovementInfo::TransportInfo::Reset(), WorldObject::SetTransport(), and MovementInfo::transport.

Referenced by Player::CleanupsBeforeDelete(), npc_commandscript::HandleNpcAddCommand(), and Map::RemoveAllObjectsInRemoveList().

◆ ClearAllReactives()

void Unit::ClearAllReactives ( )
13430{
13431 for (uint8 i = 0; i < MAX_REACTIVE; ++i)
13432 m_reactiveTimer[i] = 0;
13433
13440}
@ CLASS_HUNTER
Definition SharedDefines.h:143
@ CLASS_WARRIOR
Definition SharedDefines.h:141
@ AURA_STATE_DEFENSE
Definition SharedDefines.h:1303
@ AURA_STATE_HUNTER_PARRY
Definition SharedDefines.h:1309
@ CLASS_CONTEXT_ABILITY_REACTIVE
Definition UnitDefines.h:239
virtual bool IsClass(Classes unitClass, ClassContext context=CLASS_CONTEXT_NONE) const
Definition Unit.h:838
bool HasAuraState(AuraStateType flag, SpellInfo const *spellProto=nullptr, Unit const *Caster=nullptr) const
Definition Unit.cpp:7536

References AURA_STATE_DEFENSE, AURA_STATE_HUNTER_PARRY, CLASS_CONTEXT_ABILITY_REACTIVE, CLASS_HUNTER, CLASS_WARRIOR, ClearComboPoints(), HasAuraState(), IsClass(), Object::IsPlayer(), m_reactiveTimer, MAX_REACTIVE, and ModifyAuraState().

Referenced by Player::ActivateSpec(), and setDeathState().

◆ ClearComboPointHolders()

void Unit::ClearComboPointHolders ( )
13422{
13423 while (!m_ComboPointHolders.empty())
13424 {
13425 (*m_ComboPointHolders.begin())->ClearComboPoints(); // this also removes it from m_comboPointHolders
13426 }
13427}

References ClearComboPoints(), and m_ComboPointHolders.

Referenced by CreatureAI::_EnterEvadeMode(), CleanupBeforeRemoveFromMap(), Player::RemoveFromWorld(), and setDeathState().

◆ ClearComboPoints()

void Unit::ClearComboPoints ( )
13367{
13368 if (!m_comboTarget)
13369 {
13370 return;
13371 }
13372
13373 // remove Premed-like effects
13374 // (NB: this Aura retains the CP while it's active - now that CP have reset, it shouldn't be there anymore)
13376
13377 m_comboPoints = 0;
13380 m_comboTarget = nullptr;
13381}
@ SPELL_AURA_RETAIN_COMBO_POINTS
Definition SpellAuraDefines.h:211

References m_comboPoints, m_comboTarget, RemoveAurasByType(), RemoveComboPointHolder(), SendComboPoints(), and SPELL_AURA_RETAIN_COMBO_POINTS.

Referenced by Spell::_handle_finish_phase(), CleanupBeforeRemoveFromMap(), ClearAllReactives(), ClearComboPointHolders(), Player::DuelComplete(), Player::RemoveFromWorld(), Player::setDeathState(), and UpdateReactives().

◆ ClearDiminishings()

void Unit::ClearDiminishings ( )
inline
1846{ m_Diminishing.clear(); }

References m_Diminishing.

Referenced by setDeathState().

◆ ClearEmoteState()

void Unit::ClearEmoteState ( )
inline

Sets emote state (looping emote). Emotes available in SharedDefines.h.

void SetEmoteState(Emote emoteState)
Definition Unit.h:752

References EMOTE_ONESHOT_NONE, and SetEmoteState().

Referenced by boss_felblood_kaelthas::DoAction().

◆ ClearInCombat()

void Unit::ClearInCombat ( )
10743{
10744 m_CombatTimer = 0;
10746
10747 // Player's state will be cleared in Player::UpdateContestedPvP
10748 if (Creature* creature = ToCreature())
10749 {
10750 if (creature->GetCreatureTemplate() && creature->GetCreatureTemplate()->unit_flags & UNIT_FLAG_IMMUNE_TO_PC)
10751 SetImmuneToPC(true); // set immunity state to the one from db on evade
10752
10755 ReplaceAllDynamicFlags(creature->GetCreatureTemplate()->dynamicflags);
10756
10757 creature->SetAssistanceTimer(0);
10758
10759 // Xinef: will be recalculated at follow movement generator initialization
10760 if (!IsPet() && !IsCharmed())
10761 return;
10762 }
10763 else if (Player* player = ToPlayer())
10764 {
10765 player->UpdatePotionCooldown();
10766 if (player->IsClass(CLASS_DEATH_KNIGHT, CLASS_CONTEXT_ABILITY))
10767 for (uint8 i = 0; i < MAX_RUNES; ++i)
10768 player->SetGracePeriod(i, 0);
10769 }
10770
10771 if (Player* player = this->ToPlayer())
10772 {
10773 sScriptMgr->OnPlayerLeaveCombat(player);
10774 }
10775}
#define MAX_RUNES
Definition Player.h:385
@ CLASS_DEATH_KNIGHT
Definition SharedDefines.h:146
@ CLASS_CONTEXT_ABILITY
Definition UnitDefines.h:238
@ UNIT_STATE_ATTACK_PLAYER
Definition UnitDefines.h:184
@ UNIT_FLAG_IN_COMBAT
Definition UnitDefines.h:273
@ UNIT_FLAG_IMMUNE_TO_PC
Definition UnitDefines.h:262
void ReplaceAllDynamicFlags(uint32 flag) override
Definition Unit.h:763
bool IsCharmed() const
Definition Unit.h:1299
bool IsPet() const
Definition Unit.h:791
void SetImmuneToPC(bool apply, bool keepCombat=false)
Definition Unit.cpp:10534
void RemoveUnitFlag(UnitFlags flags)
UnitFlags available in UnitDefines.h.
Definition Unit.h:743

References CLASS_CONTEXT_ABILITY, CLASS_DEATH_KNIGHT, ClearUnitState(), Object::HasDynamicFlag(), IsCharmed(), IsPet(), m_CombatTimer, MAX_RUNES, RemoveUnitFlag(), ReplaceAllDynamicFlags(), SetImmuneToPC(), sScriptMgr, Object::ToCreature(), Object::ToPlayer(), UNIT_DYNFLAG_TAPPED, UNIT_FLAG_IMMUNE_TO_PC, UNIT_FLAG_IN_COMBAT, and UNIT_STATE_ATTACK_PLAYER.

Referenced by CombatStop(), Player::LoadFromDB(), and Update().

◆ ClearInPetCombat()

◆ ClearUnitState()

void Unit::ClearUnitState ( uint32  f)
inline
731{ m_state &= ~f; }

References m_state.

Referenced by Spell::_cast(), HomeMovementGenerator< Creature >::_setTargetLocation(), Attack(), FollowerAI::AttackStart(), npc_dark_nucleus::npc_dark_nucleusAI::AttackStart(), AttackStop(), ClearInCombat(), boss_thorim::DisableThorim(), npc_ball_of_flame::npc_ball_of_flameAI::DoAction(), HomeMovementGenerator< Creature >::DoFinalize(), WaypointMovementGenerator< Creature >::DoFinalize(), RandomMovementGenerator< T >::DoFinalize(), ConfusedMovementGenerator< T >::DoFinalize(), FlightPathMovementGenerator::DoFinalize(), FleeingMovementGenerator< T >::DoFinalize(), ConfusedMovementGenerator< T >::DoFinalize(), RandomMovementGenerator< T >::DoUpdate(), Spell::EffectResurrectPet(), boss_yoggsaron_sara::EnableSara(), boss_ayamiss::EnterEvadeMode(), SmartAI::EnterEvadeMode(), violet_hold_trashAI::EnterEvadeMode(), npc_future_you::npc_future_youAI::EnterEvadeMode(), TimedFleeingMovementGenerator::Finalize(), RotateMovementGenerator::Finalize(), DistractMovementGenerator::Finalize(), AssistanceDistractMovementGenerator::Finalize(), Spell::finish(), npc_torloth_the_magnificent::npc_torloth_the_magnificentAI::HandleAnimation(), AuraEffect::HandleAuraModSchoolImmunity(), debug_commandscript::HandleDebugUnitStateCommand(), AuraEffect::HandleFeignDeath(), WorldSession::HandlePetActionHelper(), WorldSession::HandlePetCastSpellOpcode(), FollowerAI::MoveInLineOfSight(), npc_escortAI::MoveInLineOfSight(), SmartAI::MoveInLineOfSight(), SmartAI::MovementInform(), boss_lady_vashj::MovementInform(), boss_jedoga_shadowseeker::MovementInform(), MotionMaster::MoveTargetedHome(), WaypointMovementGenerator< Creature >::OnArrived(), boss_loken::OnAuraRemove(), boss_nightbane::PathEndReached(), Creature::ReleaseFocus(), RemoveCharmedBy(), MotionTransport::RemovePassenger(), boss_ayamiss::Reset(), boss_hungarfen::Reset(), Player::ResetContestedPvP(), boss_loken::ScheduleTasks(), npc_icc_ice_sphere::npc_icc_ice_sphereAI::SelectNewTarget(), SetCharm(), Player::SetClientControl(), SmartAI::SetCombatMovement(), SetControlled(), Creature::setDeathState(), Player::setDeathState(), FollowerAI::SetFollowComplete(), FollowerAI::SetFollowPaused(), Player::SetIsSpectator(), SetRooted(), boss_urom::boss_uromAI::SpellHit(), boss_black_knight::boss_black_knightAI::SpellHitTarget(), spell_putricide_ooze_channel::StartAttack(), StopMoving(), StopMovingOnCurrentPos(), boss_devourer_of_souls::boss_devourer_of_soulsAI::UpdateAI(), npc_dark_nucleus::npc_dark_nucleusAI::UpdateAI(), and boss_the_lich_king::boss_the_lich_kingAI::UpdateAI().

◆ CombatStart()

void Unit::CombatStart ( Unit target,
bool  initialAggro = true 
)
10553{
10554 // Xinef: Dont allow to start combat with triggers
10555 if (victim->IsCreature() && victim->ToCreature()->IsTrigger())
10556 return;
10557
10558 if (initialAggro)
10559 {
10560 // Make player victim stand up automatically
10561 if (victim->getStandState() && victim->IsPlayer())
10562 {
10563 victim->SetStandState(UNIT_STAND_STATE_STAND);
10564 }
10565
10566 if (!victim->IsInCombat() && !victim->IsPlayer() && !victim->ToCreature()->HasReactState(REACT_PASSIVE) && victim->ToCreature()->IsAIEnabled)
10567 {
10568 if (victim->IsPet())
10569 victim->ToCreature()->AI()->AttackedBy(this); // PetAI has special handler before AttackStart()
10570 else
10571 {
10572 victim->ToCreature()->AI()->AttackStart(this);
10573 // if the target is an NPC with a pet or minion, pet should react.
10574 if (Unit* victimControlledUnit = victim->GetFirstControlled())
10575 {
10576 victimControlledUnit->SetInCombatWith(this);
10577 SetInCombatWith(victimControlledUnit);
10578 victimControlledUnit->AddThreat(this, 0.0f);
10579 }
10580 }
10581
10582 // if unit has an owner, put owner in combat.
10583 if (Unit* victimOwner = victim->GetOwner())
10584 {
10585 if (!(victimOwner->IsInCombatWith(this)))
10586 {
10587 /* warding off to not take over aggro for no reason
10588 Using only AddThreat causes delay in attack */
10589 if (!victimOwner->IsInCombat() && victimOwner->IsAIEnabled)
10590 {
10591 victimOwner->ToCreature()->AI()->AttackStart(this);
10592 }
10593 victimOwner->SetInCombatWith(this);
10594 SetInCombatWith(victimOwner);
10595 victimOwner->AddThreat(this, 0.0f);
10596 }
10597 }
10598 }
10599
10600 bool alreadyInCombat = IsInCombat();
10601
10602 SetInCombatWith(victim);
10603 victim->SetInCombatWith(this);
10604
10605 // Update leash timer when attacking creatures
10606 if (victim->IsCreature() && this != victim)
10607 victim->ToCreature()->UpdateLeashExtensionTime();
10608
10609 // Xinef: If pet started combat - put owner in combat
10610 if (!alreadyInCombat && IsInCombat())
10611 {
10612 if (Unit* owner = GetOwner())
10613 {
10614 owner->SetInCombatWith(victim);
10615 victim->SetInCombatWith(owner);
10616 }
10617 }
10618 }
10619
10620 Unit* who = victim->GetCharmerOrOwnerOrSelf();
10621 if (who->IsPlayer())
10622 SetContestedPvP(who->ToPlayer());
10623
10625 if (player && who->IsPvP() && (!who->IsPlayer() || !player->duel || player->duel->Opponent != who))
10626 {
10627 player->UpdatePvP(true);
10629 }
10630}
@ AURA_INTERRUPT_FLAG_ENTER_PVP_COMBAT
Definition SpellDefines.h:66
@ UNIT_STAND_STATE_STAND
Definition UnitDefines.h:32
@ REACT_PASSIVE
Definition Unit.h:560
void UpdatePvP(bool state, bool _override=false)
Definition PlayerUpdates.cpp:1532
Unit * GetCharmerOrOwnerOrSelf() const
Definition Unit.h:1276
void SetContestedPvP(Player *attackedPlayer=nullptr, bool lookForNearContestedGuards=true)
Definition Unit.cpp:13762
Unit * GetFirstControlled() const
Definition Unit.cpp:8070

References Creature::AI(), CreatureAI::AttackedBy(), UnitAI::AttackStart(), AURA_INTERRUPT_FLAG_ENTER_PVP_COMBAT, Player::duel, GetCharmerOrOwnerOrSelf(), GetCharmerOrOwnerPlayerOrPlayerItself(), GetFirstControlled(), GetOwner(), getStandState(), Creature::HasReactState(), IsAIEnabled, Object::IsCreature(), IsInCombat(), IsPet(), Object::IsPlayer(), IsPvP(), Creature::IsTrigger(), REACT_PASSIVE, RemoveAurasWithInterruptFlags(), SetContestedPvP(), SetInCombatWith(), SetStandState(), Object::ToCreature(), Object::ToPlayer(), UNIT_STAND_STATE_STAND, Creature::UpdateLeashExtensionTime(), and Player::UpdatePvP().

Referenced by AttackerStateUpdate(), Spell::CheckCast(), DealDamage(), Spell::DoAllEffectOnTarget(), Spell::EffectTaunt(), and AssistDelayEvent::Execute().

◆ CombatStartOnCast()

void Unit::CombatStartOnCast ( Unit target,
bool  initialAggro = true,
uint32  duration = 0 
)
10633{
10634 // Xinef: Dont allow to start combat with triggers
10635 if (target->IsCreature() && target->ToCreature()->IsTrigger())
10636 return;
10637
10638 if (initialAggro)
10639 {
10640 SetInCombatWith(target, duration);
10641
10642 // Xinef: If pet started combat - put owner in combat
10643 if (Unit* owner = GetOwner())
10644 owner->SetInCombatWith(target, duration);
10645
10646 // Update leash timer when attacking creatures
10647 if (target->IsCreature())
10649 else if (ToCreature()) // Reset leash if it is a spell caster, else it may evade inbetween casts
10651 }
10652
10653 Unit* who = target->GetCharmerOrOwnerOrSelf();
10654 if (who->IsPlayer())
10655 SetContestedPvP(who->ToPlayer());
10656
10658 if (player && who->IsPvP() && (!who->IsPlayer() || !player->duel || player->duel->Opponent != who))
10659 {
10660 player->UpdatePvP(true);
10662 }
10663}
bool IsTrigger() const
Definition Creature.h:80

References AURA_INTERRUPT_FLAG_ENTER_PVP_COMBAT, Player::duel, GetCharmerOrOwnerOrSelf(), GetCharmerOrOwnerPlayerOrPlayerItself(), GetOwner(), Object::IsCreature(), Object::IsPlayer(), IsPvP(), Creature::IsTrigger(), RemoveAurasWithInterruptFlags(), SetContestedPvP(), SetInCombatWith(), Object::ToCreature(), Object::ToPlayer(), Creature::UpdateLeashExtensionTime(), and Player::UpdatePvP().

Referenced by Spell::_cast().

◆ CombatStop()

void Unit::CombatStop ( bool  includingCast = false)
7426{
7427 if (includingCast && IsNonMeleeSpellCast(false))
7429
7430 AttackStop();
7432 if (IsPlayer())
7433 ToPlayer()->SendAttackSwingCancelAttack(); // melee and ranged forced attack cancel
7434 if (Creature* pCreature = ToCreature())
7435 pCreature->ClearLastLeashExtensionTimePtr();
7436 ClearInCombat();
7437
7438 // xinef: just in case
7439 if (IsPetInCombat() && !IsPlayer())
7441}
void SendAttackSwingCancelAttack()
Definition PlayerMisc.cpp:141
bool IsPetInCombat() const
Definition Unit.h:931
void ClearInPetCombat()
Definition Unit.cpp:10777
void RemoveAllAttackers()
Remove all units in m_attackers list and send them AttackStop()
Definition Unit.cpp:7473
void ClearInCombat()
Definition Unit.cpp:10742
bool AttackStop()
Force the unit to stop attacking. This will clear UNIT_STATE_MELEE_ATTACKING, Interrupt current spell...
Definition Unit.cpp:7392

References AttackStop(), ClearInCombat(), ClearInPetCombat(), InterruptNonMeleeSpells(), IsNonMeleeSpellCast(), IsPetInCombat(), Object::IsPlayer(), RemoveAllAttackers(), Player::SendAttackSwingCancelAttack(), Object::ToCreature(), and Object::ToPlayer().

Referenced by CreatureAI::_EnterEvadeMode(), PetAI::_stopAttack(), Player::ActivateTaxiPathTo(), CleanupBeforeRemoveFromMap(), CombatStopWithPets(), boss_grand_champion::boss_grand_championAI::DamageTaken(), boss_hodir::DamageTaken(), npc_ulduar_arachnopod_destroyer::DamageTaken(), npc_overlord_drakuru_betrayal::DamageTaken(), npc_magister_aledis::DamageTaken(), npc_tapoke_slim_jahn::npc_tapoke_slim_jahnAI::DamageTaken(), boss_felblood_kaelthas::DamageTaken(), npc_death_knight_initiate::npc_death_knight_initiateAI::DamageTaken(), boss_thorim::DamageTaken(), npc_crok_scourgebane::npc_crok_scourgebaneAI::DoAction(), boss_kalecgos::DoAction(), npc_spark_of_ionar::DoAction(), npc_maiev_illidan::DoAction(), npc_taskmaster_fizzule::npc_taskmaster_fizzuleAI::DoFriend(), npc_unkor_the_ruthless::npc_unkor_the_ruthlessAI::DoNice(), Spell::EffectSanctuary(), npc_tirion_fordring_tft::npc_tirion_fordringAI::EnterEvadeMode(), GuardAI::EnterEvadeMode(), TotemAI::EnterEvadeMode(), boss_doomrel::boss_doomrelAI::EnterEvadeMode(), npc_varian_wrynn::npc_varian_wrynnAI::EnterEvadeMode(), npc_thrall_bfu::npc_thrall_bfuAI::EnterEvadeMode(), npc_pos_freed_slave::npc_pos_freed_slaveAI::EnterEvadeMode(), npc_high_overlord_saurfang_igb::npc_high_overlord_saurfang_igbAI::EnterEvadeMode(), npc_muradin_bronzebeard_igb::npc_muradin_bronzebeard_igbAI::EnterEvadeMode(), gunship_npc_AI::EnterEvadeMode(), npc_gunship_boarding_addAI::EnterEvadeMode(), npc_terenas_menethil::npc_terenas_menethilAI::EnterEvadeMode(), violet_hold_trashAI::EnterEvadeMode(), npc_pet_hunter_snake_trap::EnterEvadeMode(), npc_pet_mage_mirror_image::EnterEvadeMode(), npc_escortAI::EnterEvadeMode(), FollowerAI::EnterEvadeMode(), npc_crystalline_frayer::EnterSeedPod(), npc_pet_dk_ebon_gargoyle::FlyAway(), Aura::HandleAuraSpecificMods(), misc_commandscript::HandleCombatStopCommand(), spell_q11919_q11940_drake_hunt_aura::HandleEffectRemove(), AuraEffect::HandleFeignDeath(), spell_chapter2_persuasive_strike::HandleHit(), npc_commandscript::HandleNpcDeleteCommand(), npc_echo_of_medivh::HandlePieceJustDied(), Battlefield::HideNpc(), npc_supremus_punch_invisible_stalker::IsSummonedBy(), npc_green_dragon_combat_trigger::npc_green_dragon_combat_triggerAI::JustEngagedWith(), boss_deathbringer_saurfang::boss_deathbringer_saurfangAI::JustEngagedWith(), boss_professor_putricide::boss_professor_putricideAI::JustEngagedWith(), Kill(), boss_urom::boss_uromAI::LeaveCombat(), npc_pet_dk_ebon_gargoyle::MySelectNextTarget(), SmartScript::ProcessAction(), Player::RemovePet(), npc_the_lich_king_controller::npc_the_lich_king_controllerAI::Reset(), setDeathState(), npc_venture_co_straggler::npc_venture_co_stragglerAI::SpellHit(), Player::TeleportTo(), Totem::UnSummon(), npc_highlord_darion_mograine::npc_highlord_darion_mograineAI::UpdateAI(), npc_anachronos_the_ancient::npc_anachronos_the_ancientAI::UpdateAI(), npc_snobold_vassal::npc_snobold_vassalAI::UpdateAI(), npc_frost_freeze_trap::npc_frost_freeze_trapAI::UpdateAI(), boss_stormcaller_brundir::UpdateAI(), npc_aeranas::npc_aeranasAI::UpdateAI(), npc_torloth_the_magnificent::npc_torloth_the_magnificentAI::UpdateAI(), npc_nelson::npc_nelsonAI::UpdateAI(), npc_franklin::npc_franklinAI::UpdateAI(), and npc_deaths_fel_cannon::npc_deaths_fel_cannonAI::UpdateAI().

◆ CombatStopWithPets()

void Unit::CombatStopWithPets ( bool  includingCast = false)
7444{
7445 CombatStop(includingCast);
7446
7447 for (ControlSet::const_iterator itr = m_Controlled.begin(); itr != m_Controlled.end(); ++itr)
7448 (*itr)->CombatStop(includingCast);
7449}

References CombatStop(), and m_Controlled.

Referenced by DealDamage(), WorldSession::HandleDuelCancelledOpcode(), Player::SetGameMaster(), Player::SetGMVisible(), and Player::UpdateArea().

◆ CountPctFromCurHealth()

uint32 Unit::CountPctFromCurHealth ( int32  pct) const
inline
1111{ return CalculatePct(GetHealth(), pct); }
uint32 GetHealth() const
Definition Unit.h:1097

References CalculatePct(), and GetHealth().

Referenced by spell_gen_leeching_swarm_aura::HandleEffectPeriodic().

◆ CountPctFromMaxHealth()

uint32 Unit::CountPctFromMaxHealth ( int32  pct) const
inline
1110{ return CalculatePct(GetMaxHealth(), pct); }
uint32 GetMaxHealth() const
Definition Unit.h:1098

References CalculatePct(), and GetMaxHealth().

Referenced by spell_pri_guardian_spirit::Absorb(), spell_rog_cheat_death::Absorb(), spell_pal_ardent_defender::Absorb(), spell_dru_survival_instincts_aura::AfterApply(), spell_dk_anti_magic_shell_self::CalculateAmount(), spell_dk_vampiric_blood::CalculateAmount(), boss_ichoron::boss_ichoronAI::DoAction(), Spell::EffectHeal(), Spell::EffectHealPct(), Spell::EffectResurrect(), Spell::EffectResurrectPet(), Spell::EffectSelfResurrect(), Spell::EffectSummonType(), spell_alar_ember_blast::HandleCast(), misc_commandscript::HandleDamageCommand(), spell_dk_death_strike::HandleDummy(), spell_hun_last_stand_pet::HandleDummy(), spell_warr_last_stand::HandleDummy(), AuraEffect::HandlePeriodicDummyAuraTick(), AuraEffect::HandlePeriodicHealAurasTick(), AuraEffect::HandlePeriodicTriggerSpellAuraTick(), spell_item_blood_draining_enchant::HandleProc(), spell_dk_vendetta::HandleProc(), spell_dru_leader_of_the_pack::HandleProc(), spell_pal_judgement_of_light_heal::HandleProc(), spell_pri_glyph_of_dispel_magic::HandleProc(), HealthAbovePct(), HealthAbovePctHealed(), HealthBelowPct(), HealthBelowPctDamaged(), spell_pri_lightwell_renew::InitializeAmount(), boss_harbinger_skyriss::JustSummoned(), boss_hadronox::KilledUnit(), Pet::LoadPetFromDB(), spell_gluth_decimate_damage::PrepareSpellScript(), boss_vaelastrasz::boss_vaelAI::Reset(), npc_draenei_survivor::npc_draenei_survivorAI::Reset(), npc_injured_draenei::npc_injured_draeneiAI::Reset(), boss_murmur::Reset(), npc_injured_patient::npc_injured_patientAI::Reset(), npc_crok_scourgebane::npc_crok_scourgebaneAI::UpdateAI(), and npc_injured_patient::npc_injured_patientAI::UpdateAI().

◆ CreateTamedPetFrom() [1/2]

Pet * Unit::CreateTamedPetFrom ( Creature creatureTarget,
uint32  spell_id = 0 
)
13866{
13867 if (!IsPlayer())
13868 return nullptr;
13869
13870 Pet* pet = new Pet(ToPlayer(), HUNTER_PET);
13871
13872 if (!pet->CreateBaseAtCreature(creatureTarget))
13873 {
13874 delete pet;
13875 return nullptr;
13876 }
13877
13878 uint8 level = creatureTarget->GetLevel() + 5 < GetLevel() ? (GetLevel() - 5) : creatureTarget->GetLevel();
13879
13880 if (!InitTamedPet(pet, level, spell_id))
13881 {
13882 delete pet;
13883 return nullptr;
13884 }
13885
13886 return pet;
13887}
@ HUNTER_PET
Definition PetDefines.h:33
bool CreateBaseAtCreature(Creature *creature)
Definition Pet.cpp:941
bool InitTamedPet(Pet *pet, uint8 level, uint32 spell_id)
Definition Unit.cpp:13909

References Pet::CreateBaseAtCreature(), GetLevel(), HUNTER_PET, InitTamedPet(), Object::IsPlayer(), and Object::ToPlayer().

Referenced by Player::CreatePet(), Player::CreatePet(), Spell::EffectCreateTamedPet(), and Spell::EffectTameCreature().

◆ CreateTamedPetFrom() [2/2]

Pet * Unit::CreateTamedPetFrom ( uint32  creatureEntry,
uint32  spell_id = 0 
)
13890{
13891 if (!IsPlayer())
13892 return nullptr;
13893
13894 CreatureTemplate const* creatureInfo = sObjectMgr->GetCreatureTemplate(creatureEntry);
13895 if (!creatureInfo)
13896 return nullptr;
13897
13898 Pet* pet = new Pet(ToPlayer(), HUNTER_PET);
13899
13900 if (!pet->CreateBaseAtCreatureInfo(creatureInfo, this) || !InitTamedPet(pet, GetLevel(), spell_id))
13901 {
13902 delete pet;
13903 return nullptr;
13904 }
13905
13906 return pet;
13907}
#define sObjectMgr
Definition ObjectMgr.h:1699
bool CreateBaseAtCreatureInfo(CreatureTemplate const *cinfo, Unit *owner)
Definition Pet.cpp:976
Definition CreatureData.h:186

References Pet::CreateBaseAtCreatureInfo(), GetLevel(), HUNTER_PET, InitTamedPet(), Object::IsPlayer(), sObjectMgr, and Object::ToPlayer().

◆ CreateVehicleKit()

bool Unit::CreateVehicleKit ( uint32  id,
uint32  creatureEntry 
)

Returns the transport this unit is on directly (if on vehicle and transport, return vehicle)

15082{
15083 VehicleEntry const* vehInfo = sVehicleStore.LookupEntry(id);
15084 if (!vehInfo)
15085 return false;
15086
15087 m_vehicleKit = new Vehicle(this, vehInfo, creatureEntry);
15090 return true;
15091}
DBCStorage< VehicleEntry > sVehicleStore(VehicleEntryfmt)
@ UNIT_MASK_VEHICLE
Definition UnitDefines.h:161
@ UPDATEFLAG_VEHICLE
Definition UpdateData.h:46

References m_unitTypeMask, Object::m_updateFlag, m_vehicleKit, sVehicleStore, UNIT_MASK_VEHICLE, and UPDATEFLAG_VEHICLE.

Referenced by Creature::CreateFromProto(), AuraEffect::HandleAuraSetVehicle(), Mount(), and npc_isle_of_conquest_turret::npc_isle_of_conquest_turretAI::SpellHit().

◆ DealDamage()

uint32 Unit::DealDamage ( Unit attacker,
Unit victim,
uint32  damage,
CleanDamage const *  cleanDamage = nullptr,
DamageEffectType  damagetype = DIRECT_DAMAGE,
SpellSchoolMask  damageSchoolMask = SPELL_SCHOOL_MASK_NORMAL,
SpellInfo const *  spellProto = nullptr,
bool  durabilityLoss = true,
bool  allowGM = false,
Spell const *  spell = nullptr 
)
static

@fix: Hack to avoid premature leashing

933{
934 damage = sScriptMgr->DealDamage(attacker, victim, damage, damagetype);
935 // Xinef: initialize damage done for rage calculations
936 // Xinef: its rare to modify damage in hooks, however training dummy's sets damage to 0
937 uint32 rage_damage = damage + ((cleanDamage != nullptr) ? cleanDamage->absorbed_damage : 0);
938
939 //if (attacker)
940 {
941 if (victim->IsAIEnabled)
942 victim->GetAI()->DamageTaken(attacker, damage, damagetype, damageSchoolMask);
943
944 if (attacker && attacker->IsAIEnabled)
945 attacker->GetAI()->DamageDealt(victim, damage, damagetype, damageSchoolMask);
946 }
947
948 // Hook for OnDamage Event
949 sScriptMgr->OnDamage(attacker, victim, damage);
950
951 if (victim->IsPlayer() && attacker != victim)
952 {
953 // Signal to pets that their owner was attacked
954 Pet* pet = victim->ToPlayer()->GetPet();
955
956 if (pet && pet->IsAlive())
957 pet->AI()->OwnerAttackedBy(attacker);
958 }
959
960 //Dont deal damage to unit if .cheat god is enable.
961 if (victim->IsPlayer())
962 {
963 if (victim->ToPlayer()->GetCommandStatus(CHEAT_GOD))
964 {
965 return 0;
966 }
967 }
968
969 // Signal the pet it was attacked so the AI can respond if needed
970 if (victim->IsCreature() && attacker != victim && victim->IsPet() && victim->IsAlive())
971 victim->ToPet()->AI()->AttackedBy(attacker);
972
973 if (damagetype != NODAMAGE)
974 {
975 // interrupting auras with AURA_INTERRUPT_FLAG_DAMAGE before checking !damage (absorbed damage breaks that type of auras)
976 if (spellProto)
977 {
978 if (attacker && damagetype != DOT && spellProto->DmgClass == SPELL_DAMAGE_CLASS_MELEE && !(spellProto->GetSchoolMask() & SPELL_SCHOOL_MASK_HOLY))
979 attacker->DealDamageShieldDamage(victim);
980
981 if (!spellProto->HasAttribute(SPELL_ATTR4_REACTIVE_DAMAGE_PROC))
983 }
984 else
986
987 // interrupt spells with SPELL_INTERRUPT_FLAG_ABORT_ON_DMG on absorbed damage (no dots)
988 if (!damage && damagetype != DOT && cleanDamage && cleanDamage->absorbed_damage)
989 {
990 if (victim != attacker && victim->IsPlayer())
991 {
992 if (Spell* spell = victim->m_currentSpells[CURRENT_GENERIC_SPELL])
993 {
994 if (spell->getState() == SPELL_STATE_PREPARING)
995 {
996 uint32 interruptFlags = spell->m_spellInfo->InterruptFlags;
997 if (interruptFlags & SPELL_INTERRUPT_FLAG_ABORT_ON_DMG)
998 {
999 victim->InterruptNonMeleeSpells(false);
1000 }
1001 }
1002 }
1003 }
1004 }
1005
1006 // We're going to call functions which can modify content of the list during iteration over it's elements
1007 // Let's copy the list so we can prevent iterator invalidation
1009 // copy damage to casters of this aura
1010 for (AuraEffectList::iterator i = vCopyDamageCopy.begin(); i != vCopyDamageCopy.end(); ++i)
1011 {
1012 // Check if aura was removed during iteration - we don't need to work on such auras
1013 if (!((*i)->GetBase()->IsAppliedOnTarget(victim->GetGUID())))
1014 continue;
1015 // check damage school mask
1016 if (((*i)->GetMiscValue() & damageSchoolMask) == 0)
1017 continue;
1018
1019 Unit* shareDamageTarget = (*i)->GetCaster();
1020 if (!shareDamageTarget)
1021 continue;
1022 SpellInfo const* spell = (*i)->GetSpellInfo();
1023
1024 uint32 shareDamage = CalculatePct(damage, (*i)->GetAmount());
1025
1026 uint32 shareAbsorb = 0;
1027 uint32 shareResist = 0;
1028
1029 if (shareDamageTarget->IsImmunedToDamageOrSchool(damageSchoolMask))
1030 {
1031 shareAbsorb = shareDamage;
1032 shareDamage = 0;
1033 }
1034 else
1035 {
1036 DamageInfo sharedDamageInfo(attacker, shareDamageTarget, shareDamage, spellProto, damageSchoolMask, damagetype);
1037 Unit::CalcAbsorbResist(sharedDamageInfo, true);
1038 shareAbsorb = sharedDamageInfo.GetAbsorb();
1039 shareResist = sharedDamageInfo.GetResist();
1040 shareDamage = sharedDamageInfo.GetDamage();
1041 Unit::DealDamageMods(shareDamageTarget, shareDamage, &shareAbsorb);
1042 }
1043
1044 if (attacker && shareDamageTarget->IsPlayer())
1045 {
1046 attacker->SendSpellNonMeleeDamageLog(shareDamageTarget, spell, shareDamage, damageSchoolMask, shareAbsorb, shareResist, damagetype == DIRECT_DAMAGE, 0, false, true);
1047 }
1048
1049 Unit::DealDamage(attacker, shareDamageTarget, shareDamage, cleanDamage, NODAMAGE, damageSchoolMask, spellProto, false, false, damageSpell);
1050 }
1051 }
1052
1053 // Rage from Damage made (only from direct weapon damage)
1054 if (attacker && cleanDamage && damagetype == DIRECT_DAMAGE && attacker != victim && attacker->HasActivePowerType(POWER_RAGE))
1055 {
1056 uint32 weaponSpeedHitFactor;
1057
1058 switch (cleanDamage->attackType)
1059 {
1060 case BASE_ATTACK:
1061 case OFF_ATTACK:
1062 {
1063 weaponSpeedHitFactor = uint32(attacker->GetAttackTime(cleanDamage->attackType) / 1000.0f * (cleanDamage->attackType == BASE_ATTACK ? 3.5f : 1.75f));
1064 if (cleanDamage->hitOutCome == MELEE_HIT_CRIT)
1065 weaponSpeedHitFactor *= 2;
1066
1067 attacker->RewardRage(rage_damage, weaponSpeedHitFactor, true);
1068 break;
1069 }
1070 case RANGED_ATTACK:
1071 break;
1072 default:
1073 break;
1074 }
1075 }
1076
1077 if (!damage)
1078 {
1079 // Rage from absorbed damage
1080 if (cleanDamage && cleanDamage->absorbed_damage)
1081 {
1082 if (victim->HasActivePowerType(POWER_RAGE))
1083 victim->RewardRage(cleanDamage->absorbed_damage, 0, false);
1084
1085 if (attacker && attacker->HasActivePowerType(POWER_RAGE))
1086 attacker->RewardRage(cleanDamage->absorbed_damage, 0, true);
1087 }
1088
1089 return 0;
1090 }
1091
1092 LOG_DEBUG("entities.unit", "DealDamageStart");
1093
1094 uint32 health = victim->GetHealth();
1095 LOG_DEBUG("entities.unit", "deal dmg:{} to health:{} ", damage, health);
1096
1097 // duel ends when player has 1 or less hp
1098 bool duel_hasEnded = false;
1099 bool duel_wasMounted = false;
1100 if (victim->IsPlayer() && victim->ToPlayer()->duel && damage >= (health - 1))
1101 {
1102 // xinef: situation not possible earlier, just return silently.
1103 if (!attacker)
1104 return 0;
1105
1106 // prevent kill only if killed in duel and killed by opponent or opponent controlled creature
1107 if (victim->ToPlayer()->duel->Opponent == attacker || victim->ToPlayer()->duel->Opponent->GetGUID() == attacker->GetOwnerGUID())
1108 damage = health - 1;
1109
1110 duel_hasEnded = true;
1111 }
1112 else if (victim->IsVehicle() && damage >= (health - 1) && victim->GetCharmer() && victim->GetCharmer()->IsPlayer())
1113 {
1114 Player* victimRider = victim->GetCharmer()->ToPlayer();
1115
1116 if (victimRider && victimRider->duel && victimRider->duel->IsMounted)
1117 {
1118 // xinef: situation not possible earlier, just return silently.
1119 if (!attacker)
1120 return 0;
1121
1122 // prevent kill only if killed in duel and killed by opponent or opponent controlled creature
1123 if (victimRider->duel->Opponent == attacker || victimRider->duel->Opponent->GetGUID() == attacker->GetCharmerGUID())
1124 damage = health - 1;
1125
1126 duel_wasMounted = true;
1127 duel_hasEnded = true;
1128 }
1129 }
1130
1131 if (attacker && attacker != victim)
1132 if (Player* killer = attacker->GetCharmerOrOwnerPlayerOrPlayerItself())
1133 {
1134 // pussywizard: don't allow GMs to deal damage in normal way (this leaves no evidence in logs!), they have commands to do so
1135 //if (!allowGM && killer->GetSession()->GetSecurity() && killer->GetSession()->GetSecurity() <= SEC_ADMINISTRATOR)
1136 // return 0;
1137
1138 if (Battleground* bg = killer->GetBattleground())
1139 {
1140 bg->UpdatePlayerScore(killer, SCORE_DAMAGE_DONE, damage);
1141 killer->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_DAMAGE_DONE, damage, 0, victim); // pussywizard: InBattleground() optimization
1142 }
1143 //killer->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_HIT_DEALT, damage); // pussywizard: optimization
1144 }
1145
1146 if (victim->IsPlayer())
1147 ;//victim->ToPlayer()->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_HIT_RECEIVED, damage); // pussywizard: optimization
1148 else if (!victim->IsControlledByPlayer() || victim->IsVehicle())
1149 {
1150 if (!victim->ToCreature()->hasLootRecipient())
1151 victim->ToCreature()->SetLootRecipient(attacker);
1152
1153 if (!attacker || attacker->IsControlledByPlayer() || attacker->IsCreatedByPlayer())
1154 {
1155 uint32 unDamage = health < damage ? health : damage;
1156 bool damagedByPlayer = unDamage && attacker && (attacker->IsPlayer() || attacker->m_movedByPlayer != nullptr);
1157 victim->ToCreature()->LowerPlayerDamageReq(unDamage, damagedByPlayer);
1158 }
1159 }
1160
1161 // Sparring
1162 if (victim->CanSparringWith(attacker))
1163 {
1164 if (damage >= victim->GetHealth())
1165 damage = 0;
1166
1167 uint32 sparringHealth = victim->GetHealth() * (victim->ToCreature()->GetSparringPct() / 100);
1168 if (victim->GetHealth() - damage <= sparringHealth)
1169 damage = 0;
1170 }
1171
1172 if (health <= damage)
1173 {
1174 LOG_DEBUG("entities.unit", "DealDamage: victim just died");
1175
1176 //if (attacker && victim->IsPlayer() && victim != attacker)
1177 //victim->ToPlayer()->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_TOTAL_DAMAGE_RECEIVED, health); // pussywizard: optimization
1178 Unit::Kill(attacker, victim, durabilityLoss, cleanDamage ? cleanDamage->attackType : BASE_ATTACK, spellProto, damageSpell);
1179 }
1180 else
1181 {
1182 LOG_DEBUG("entities.unit", "DealDamageAlive");
1183
1184 //if (victim->IsPlayer())
1185 // victim->ToPlayer()->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_TOTAL_DAMAGE_RECEIVED, damage); // pussywizard: optimization
1186
1187 victim->ModifyHealth(- (int32)damage);
1188
1189 if (damagetype == DIRECT_DAMAGE || damagetype == SPELL_DIRECT_DAMAGE)
1190 victim->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_DIRECT_DAMAGE, spellProto ? spellProto->Id : 0);
1191
1192 if (!victim->IsPlayer())
1193 {
1195 if (damagetype != DOT && damage > 0 && !victim->GetOwnerGUID().IsPlayer() && (!spellProto || !spellProto->HasAura(SPELL_AURA_DAMAGE_SHIELD)))
1197
1198 if (attacker && attacker != victim)
1199 {
1200 if (spellProto && victim->CanHaveThreatList() && !victim->HasUnitState(UNIT_STATE_EVADE) && !victim->IsInCombatWith(attacker))
1201 victim->CombatStart(attacker, !(spellProto->AttributesEx3 & SPELL_ATTR3_SUPPRESS_TARGET_PROCS));
1202
1203 victim->AddThreat(attacker, float(damage), damageSchoolMask, spellProto);
1204 }
1205 }
1206 else // victim is a player
1207 {
1208 // random durability for items (HIT TAKEN)
1210 {
1213 }
1214 }
1215
1216 // Rage from damage received
1217 if (attacker != victim && victim->HasActivePowerType(POWER_RAGE))
1218 {
1219 uint32 rageDamage = damage + (cleanDamage ? cleanDamage->absorbed_damage : 0);
1220 victim->RewardRage(rageDamage, 0, false);
1221 }
1222
1223 if (attacker && attacker->IsPlayer())
1224 {
1225 // random durability for items (HIT DONE)
1227 {
1229 attacker->ToPlayer()->DurabilityPointLossForEquipSlot(slot);
1230 }
1231 }
1232
1233 if (damagetype != NODAMAGE && damage && (!spellProto || !(spellProto->HasAttribute(SPELL_ATTR3_TREAT_AS_PERIODIC) || spellProto->HasAttribute(SPELL_ATTR7_DONT_CAUSE_SPELL_PUSHBACK))))
1234 {
1235 if (victim != attacker && victim->IsPlayer()) // does not support creature push_back
1236 {
1237 if (damagetype != DOT && !(damageSpell && damageSpell->m_targets.HasDstChannel()))
1238 {
1239 if (Spell* spell = victim->m_currentSpells[CURRENT_GENERIC_SPELL])
1240 {
1241 if (spell->getState() == SPELL_STATE_PREPARING)
1242 {
1243 uint32 interruptFlags = spell->m_spellInfo->InterruptFlags;
1244 if (interruptFlags & SPELL_INTERRUPT_FLAG_ABORT_ON_DMG)
1245 {
1246 victim->InterruptNonMeleeSpells(false);
1247 }
1248 else if (interruptFlags & SPELL_INTERRUPT_FLAG_PUSH_BACK)
1249 {
1250 spell->Delayed();
1251 }
1252 }
1253 }
1254
1255 if (Spell* spell = victim->m_currentSpells[CURRENT_CHANNELED_SPELL])
1256 if (spell->getState() == SPELL_STATE_CASTING)
1257 {
1258 if ((spell->m_spellInfo->ChannelInterruptFlags & CHANNEL_FLAG_DELAY) != 0)
1259 {
1260 spell->DelayedChannel();
1261 }
1262 }
1263 }
1264 }
1265 }
1266
1267 // last damage from duel opponent
1268 if (duel_hasEnded)
1269 {
1270 Player* he = duel_wasMounted ? victim->GetCharmer()->ToPlayer() : victim->ToPlayer();
1271
1272 ASSERT_NODEBUGINFO(he && he->duel);
1273
1274 if (duel_wasMounted) // In this case victim==mount
1275 victim->SetHealth(1);
1276 else
1277 he->SetHealth(1);
1278
1279 he->duel->Opponent->CombatStopWithPets(true);
1280 he->CombatStopWithPets(true);
1281
1282 he->CastSpell(he, 7267, true); // beg
1284 }
1285 }
1286
1287 LOG_DEBUG("entities.unit", "DealDamageEnd returned {} damage", damage);
1288
1289 return damage;
1290}
@ SCORE_DAMAGE_DONE
Definition BattlegroundScore.h:32
@ ACHIEVEMENT_CRITERIA_TYPE_DAMAGE_DONE
Definition DBCEnums.h:130
#define ASSERT_NODEBUGINFO
Definition Errors.h:69
@ CHEAT_GOD
Definition Player.h:995
EquipmentSlots
Definition Player.h:659
@ EQUIPMENT_SLOT_END
Definition Player.h:680
bool roll_chance_f(float chance)
Definition Random.h:57
@ POWER_RAGE
Definition SharedDefines.h:281
@ SPELL_ATTR7_DONT_CAUSE_SPELL_PUSHBACK
Definition SharedDefines.h:658
@ SPELL_ATTR3_TREAT_AS_PERIODIC
Definition SharedDefines.h:529
@ SPELL_ATTR3_SUPPRESS_TARGET_PROCS
Definition SharedDefines.h:521
@ DUEL_WON
Definition SharedDefines.h:3869
@ SPELL_ATTR4_REACTIVE_DAMAGE_PROC
Definition SharedDefines.h:555
@ SPELL_AURA_DAMAGE_SHIELD
Definition SpellAuraDefines.h:78
@ SPELL_AURA_SHARE_DAMAGE_PCT
Definition SpellAuraDefines.h:363
@ CHANNEL_FLAG_DELAY
Definition SpellDefines.h:38
@ AURA_INTERRUPT_FLAG_TAKE_DAMAGE
Definition SpellDefines.h:44
@ AURA_INTERRUPT_FLAG_DIRECT_DAMAGE
Definition SpellDefines.h:67
@ SPELL_INTERRUPT_FLAG_ABORT_ON_DMG
Definition SpellDefines.h:30
@ SPELL_INTERRUPT_FLAG_PUSH_BACK
Definition SpellDefines.h:27
@ SPELL_STATE_PREPARING
Definition Spell.h:235
@ SPELL_STATE_CASTING
Definition Spell.h:236
@ NODAMAGE
Definition Unit.h:259
@ CURRENT_CHANNELED_SPELL
Definition Unit.h:551
@ CURRENT_GENERIC_SPELL
Definition Unit.h:550
@ RATE_DURABILITY_LOSS_DAMAGE
Definition WorldConfig.h:482
virtual void OwnerAttackedBy(Unit *)
Definition CreatureAI.h:177
virtual void AttackedBy(Unit *)
Definition CreatureAI.h:154
void SetLootRecipient(Unit *unit, bool withGroup=true)
Definition Creature.cpp:1281
bool hasLootRecipient() const
Definition Creature.h:233
float GetSparringPct() const
Definition Creature.h:190
void LowerPlayerDamageReq(uint32 unDamage, bool damagedByPlayer=true)
Definition Creature.cpp:3680
bool IsPlayer() const
Definition ObjectGuid.h:168
void UpdateAchievementCriteria(AchievementCriteriaTypes type, uint32 miscValue1=0, uint32 miscValue2=0, Unit *unit=nullptr)
Definition PlayerUpdates.cpp:2166
void DurabilityPointLossForEquipSlot(EquipmentSlots slot)
Definition Player.cpp:4730
Pet * GetPet() const
Definition Player.cpp:8947
bool GetCommandStatus(uint32 command) const
Definition Player.h:1197
uint32 ChannelInterruptFlags
Definition SpellInfo.h:354
uint32 InterruptFlags
Definition SpellInfo.h:352
virtual void DamageDealt(Unit *, uint32 &, DamageEffectType, SpellSchoolMask)
Called at any Damage to any victim (before damage apply)
Definition UnitAI.h:361
virtual void DamageTaken(Unit *, uint32 &, DamageEffectType, SpellSchoolMask)
Called at any Damage from any attacker (before damage apply)
Definition UnitAI.h:368
int32 ModifyHealth(int32 val)
Definition Unit.cpp:11039
Pet * ToPet()
Definition Unit.h:723
bool IsCreatedByPlayer() const
Definition Unit.h:1297
Unit * GetCharmer() const
Definition Unit.cpp:7597
static void Kill(Unit *killer, Unit *victim, bool durabilityLoss=true, WeaponAttackType attackType=BASE_ATTACK, SpellInfo const *spellProto=nullptr, Spell const *spell=nullptr)
Definition Unit.cpp:14077
void RewardRage(uint32 damage, uint32 weaponSpeedHitFactor, bool attacker)
Definition Unit.cpp:16230
void SetHealth(uint32 val)
Definition Unit.cpp:12488
ObjectGuid GetCharmerGUID() const
Definition Unit.h:713
void DealDamageShieldDamage(Unit *victim)
Definition Unit.cpp:2070
virtual bool HasActivePowerType(Powers power)
Definition Unit.h:1121
void CombatStopWithPets(bool includingCast=false)
Definition Unit.cpp:7443

References CleanDamage::absorbed_damage, ACHIEVEMENT_CRITERIA_TYPE_DAMAGE_DONE, AddThreat(), Creature::AI(), ASSERT_NODEBUGINFO, CreatureAI::AttackedBy(), CleanDamage::attackType, SpellInfo::AttributesEx3, AURA_INTERRUPT_FLAG_DIRECT_DAMAGE, AURA_INTERRUPT_FLAG_TAKE_DAMAGE, BASE_ATTACK, CalcAbsorbResist(), CalculatePct(), CanHaveThreatList(), CanSparringWith(), CastSpell(), CHANNEL_FLAG_DELAY, CHEAT_GOD, CombatStart(), CombatStopWithPets(), CURRENT_CHANNELED_SPELL, CURRENT_GENERIC_SPELL, UnitAI::DamageDealt(), UnitAI::DamageTaken(), DealDamage(), DealDamageMods(), DealDamageShieldDamage(), DIRECT_DAMAGE, SpellInfo::DmgClass, DOT, Player::duel, DUEL_WON, Player::DuelComplete(), Player::DurabilityPointLossForEquipSlot(), EQUIPMENT_SLOT_END, DamageInfo::GetAbsorb(), GetAI(), GetAttackTime(), GetAuraEffectsByType(), GetCharmer(), GetCharmerGUID(), GetCharmerOrOwnerPlayerOrPlayerItself(), Player::GetCommandStatus(), DamageInfo::GetDamage(), Object::GetGUID(), GetHealth(), GetOwnerGUID(), Player::GetPet(), DamageInfo::GetResist(), SpellInfo::GetSchoolMask(), Creature::GetSparringPct(), HasActivePowerType(), SpellInfo::HasAttribute(), SpellInfo::HasAura(), SpellCastTargets::HasDstChannel(), Creature::hasLootRecipient(), HasUnitState(), CleanDamage::hitOutCome, SpellInfo::Id, InterruptNonMeleeSpells(), IsAIEnabled, IsAlive(), IsControlledByPlayer(), IsCreatedByPlayer(), Object::IsCreature(), IsImmunedToDamageOrSchool(), IsInCombatWith(), IsPet(), Object::IsPlayer(), ObjectGuid::IsPlayer(), IsVehicle(), Kill(), LOG_DEBUG, Creature::LowerPlayerDamageReq(), m_currentSpells, m_movedByPlayer, Spell::m_targets, MELEE_HIT_CRIT, ModifyHealth(), NODAMAGE, OFF_ATTACK, CreatureAI::OwnerAttackedBy(), POWER_RAGE, RANGED_ATTACK, RATE_DURABILITY_LOSS_DAMAGE, RemoveAurasWithInterruptFlags(), RewardRage(), roll_chance_f(), SCORE_DAMAGE_DONE, SendSpellNonMeleeDamageLog(), SetHealth(), Creature::SetLootRecipient(), SPELL_ATTR3_SUPPRESS_TARGET_PROCS, SPELL_ATTR3_TREAT_AS_PERIODIC, SPELL_ATTR4_REACTIVE_DAMAGE_PROC, SPELL_ATTR7_DONT_CAUSE_SPELL_PUSHBACK, SPELL_AURA_DAMAGE_SHIELD, SPELL_AURA_SHARE_DAMAGE_PCT, SPELL_DAMAGE_CLASS_MELEE, SPELL_DIRECT_DAMAGE, SPELL_INTERRUPT_FLAG_ABORT_ON_DMG, SPELL_INTERRUPT_FLAG_PUSH_BACK, SPELL_SCHOOL_MASK_HOLY, SPELL_STATE_CASTING, SPELL_STATE_PREPARING, sScriptMgr, sWorld, Object::ToCreature(), ToPet(), Object::ToPlayer(), UNIT_STATE_EVADE, Player::UpdateAchievementCriteria(), Creature::UpdateLeashExtensionTime(), and urand().

Referenced by CalcAbsorbResist(), DealDamage(), DealDamageShieldDamage(), DealMeleeDamage(), DealSpellDamage(), npc_the_scourge_cauldron::npc_the_scourge_cauldronAI::DoDie(), Spell::EffectInstaKill(), Player::EnvironmentalDamage(), spell_mt_phoenix_burn::HandleAfterCast(), spell_alar_ember_blast::HandleCast(), misc_commandscript::HandleDamageCommand(), misc_commandscript::HandleDieCommand(), spell_svala_ritual_strike::HandleDummyEffect(), spell_valkyr_touch_aura::HandleEffectPeriodic(), spell_lady_vashj_magic_barrier::HandleEffectRemove(), spell_algalon_collapse_aura::HandlePeriodic(), spell_kaelthas_burn::HandlePeriodic(), AuraEffect::HandlePeriodicDamageAurasTick(), AuraEffect::HandlePeriodicDummyAuraTick(), AuraEffect::HandlePeriodicHealAurasTick(), AuraEffect::HandlePeriodicHealthLeechAuraTick(), spell_gluth_decimate::HandleScriptEffect(), npc_necrotic_shard::SpellHit(), npc_hor_lich_king::npc_hor_lich_kingAI::SpellHitTarget(), npc_infra_green_bomber_generic::npc_infra_green_bomber_genericAI::UpdateAI(), npc_dragonmaw_peon::npc_dragonmaw_peonAI::UpdateAI(), and Player::UpdateCharmedAI().

◆ DealDamageMods()

void Unit::DealDamageMods ( Unit const *  victim,
uint32 damage,
uint32 absorb 
)
static

◆ DealDamageShieldDamage()

void Unit::DealDamageShieldDamage ( Unit victim)
Todo:
: Move this to a packet handler
2071{
2072 // We're going to call functions which can modify content of the list during iteration over it's elements
2073 // Let's copy the list so we can prevent iterator invalidation
2075 for (AuraEffectList::const_iterator dmgShieldItr = vDamageShieldsCopy.begin(); dmgShieldItr != vDamageShieldsCopy.end(); ++dmgShieldItr)
2076 {
2077 SpellInfo const* i_spellProto = (*dmgShieldItr)->GetSpellInfo();
2078 // Damage shield can be resisted...
2079 if (SpellMissInfo missInfo = victim->SpellHitResult(this, i_spellProto, false))
2080 {
2081 victim->SendSpellMiss(this, i_spellProto->Id, missInfo);
2082 continue;
2083 }
2084
2085 // ...or immuned
2086 if (IsImmunedToDamageOrSchool(i_spellProto))
2087 {
2088 victim->SendSpellDamageImmune(this, i_spellProto->Id);
2089 continue;
2090 }
2091
2092 uint32 damage = uint32(std::max(0, (*dmgShieldItr)->GetAmount())); // xinef: done calculated at amount calculation
2093
2094 if (Unit* caster = (*dmgShieldItr)->GetCaster())
2095 {
2096 damage = caster->SpellDamageBonusDone(this, i_spellProto, damage, SPELL_DIRECT_DAMAGE, (*dmgShieldItr)->GetEffIndex());
2097 damage = this->SpellDamageBonusTaken(caster, i_spellProto, damage, SPELL_DIRECT_DAMAGE);
2098 }
2099
2100 uint32 absorb = 0;
2101
2102 DamageInfo dmgInfo(victim, this, damage, i_spellProto, i_spellProto->GetSchoolMask(), SPELL_DIRECT_DAMAGE);
2103 Unit::CalcAbsorbResist(dmgInfo);
2104 absorb = dmgInfo.GetAbsorb();
2105 damage = dmgInfo.GetDamage();
2106
2107 Unit::DealDamageMods(this, damage, &absorb);
2108
2110 WorldPacket data(SMSG_SPELLDAMAGESHIELD, (8 + 8 + 4 + 4 + 4 + 4));
2111 data << victim->GetGUID();
2112 data << GetGUID();
2113 data << uint32(i_spellProto->Id);
2114 data << uint32(damage); // Damage
2115 int32 overkill = int32(damage) - int32(GetHealth());
2116 data << uint32(overkill > 0 ? overkill : 0); // Overkill
2117 data << uint32(i_spellProto->GetSchoolMask());
2118 victim->SendMessageToSet(&data, true);
2119
2120 Unit::DealDamage(victim, this, damage, 0, SPELL_DIRECT_DAMAGE, i_spellProto->GetSchoolMask(), i_spellProto, true);
2121 }
2122}
SpellMissInfo
Definition SharedDefines.h:1529
SpellSchoolMask GetSchoolMask() const
Definition SpellInfo.cpp:1877
void SendSpellMiss(Unit *target, uint32 spellID, SpellMissInfo missInfo)
Definition Unit.cpp:6800
void SendSpellDamageImmune(Unit *target, uint32 spellId)
Definition Unit.cpp:6824
SpellMissInfo SpellHitResult(Unit *victim, SpellInfo const *spell, bool canReflect=false)
Definition Unit.cpp:3600
uint32 SpellDamageBonusTaken(Unit *caster, SpellInfo const *spellProto, uint32 pdamage, DamageEffectType damagetype, uint32 stack=1)
Definition Unit.cpp:8772
virtual void SendMessageToSet(WorldPacket const *data, bool self) const
Definition Object.cpp:2083
@ SMSG_SPELLDAMAGESHIELD
Definition Opcodes.h:621

References CalcAbsorbResist(), DealDamage(), DealDamageMods(), DamageInfo::GetAbsorb(), GetAuraEffectsByType(), DamageInfo::GetDamage(), Object::GetGUID(), Object::GetGUID(), GetHealth(), SpellInfo::GetSchoolMask(), SpellInfo::Id, IsImmunedToDamageOrSchool(), WorldObject::SendMessageToSet(), SendSpellDamageImmune(), SendSpellMiss(), SMSG_SPELLDAMAGESHIELD, SPELL_AURA_DAMAGE_SHIELD, SPELL_DIRECT_DAMAGE, SpellDamageBonusTaken(), and SpellHitResult().

Referenced by DealDamage(), and DealMeleeDamage().

◆ DealHeal()

int32 Unit::DealHeal ( Unit healer,
Unit victim,
uint32  addhealth 
)
static
7947{
7948 int32 gain = 0;
7949
7950 if (healer)
7951 {
7952 if (victim->IsAIEnabled)
7953 victim->GetAI()->HealReceived(healer, addhealth);
7954
7955 if (healer->IsAIEnabled)
7956 healer->GetAI()->HealDone(victim, addhealth);
7957 }
7958
7959 if (addhealth)
7960 gain = victim->ModifyHealth(int32(addhealth));
7961
7962 // Hook for OnHeal Event
7963 sScriptMgr->OnHeal(healer, victim, (uint32&)gain);
7964
7965 Unit* unit = healer;
7966
7967 if (healer && healer->IsCreature() && healer->ToCreature()->IsTotem())
7968 unit = healer->GetOwner();
7969
7970 if (!unit)
7971 return gain;
7972
7973 if (Player* player = unit->ToPlayer())
7974 {
7975 if (Battleground* bg = player->GetBattleground())
7976 bg->UpdatePlayerScore(player, SCORE_HEALING_DONE, gain);
7977
7978 // use the actual gain, as the overheal shall not be counted, skip gain 0 (it ignored anyway in to criteria)
7979 if (gain && player->InBattleground()) // pussywizard: InBattleground() optimization
7980 player->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_HEALING_DONE, gain, 0, victim);
7981
7982 //player->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_HEAL_CASTED, addhealth); // pussywizard: optimization
7983 }
7984
7985 /*if (Player* player = victim->ToPlayer())
7986 {
7987 //player->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_TOTAL_HEALING_RECEIVED, gain); // pussywizard: optimization
7988 //player->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_HEALING_RECEIVED, addhealth); // pussywizard: optimization
7989 }*/
7990
7991 return gain;
7992}
@ SCORE_HEALING_DONE
Definition BattlegroundScore.h:33
@ ACHIEVEMENT_CRITERIA_TYPE_HEALING_DONE
Definition DBCEnums.h:169
virtual void HealReceived(Unit *, uint32 &)
Called when the creature receives heal.
Definition UnitAI.h:371
virtual void HealDone(Unit *, uint32 &)
Called when the unit heals.
Definition UnitAI.h:377

References ACHIEVEMENT_CRITERIA_TYPE_HEALING_DONE, GetAI(), GetOwner(), UnitAI::HealDone(), UnitAI::HealReceived(), IsAIEnabled, Object::IsCreature(), IsTotem(), ModifyHealth(), SCORE_HEALING_DONE, sScriptMgr, Object::ToCreature(), and Object::ToPlayer().

Referenced by AuraEffect::HandlePeriodicHealAurasTick(), HealBySpell(), and npc_crok_scourgebane::npc_crok_scourgebaneAI::UpdateAI().

◆ DealMeleeDamage()

void Unit::DealMeleeDamage ( CalcDamageInfo damageInfo,
bool  durabilityLoss 
)
1947{
1948 Unit* victim = damageInfo->target;
1949
1950 auto canTakeMeleeDamage = [&]()
1951 {
1952 return victim->IsAlive() && !victim->IsInFlight() && (!victim->IsCreature() || !victim->ToCreature()->IsEvadingAttacks());
1953 };
1954
1955 if (!canTakeMeleeDamage())
1956 {
1957 return;
1958 }
1959
1960 // Hmmmm dont like this emotes client must by self do all animations
1961 if (damageInfo->HitInfo & HITINFO_CRITICALHIT)
1963 if (damageInfo->blocked_amount && damageInfo->TargetState != VICTIMSTATE_BLOCKS)
1965
1966 // Parry haste is enabled if it's not a creature or if the creature doesn't have the NO_PARRY_HASTEN flag.
1967 bool isParryHasteEnabled = !victim->IsCreature() ||
1969 if (damageInfo->TargetState == VICTIMSTATE_PARRY && isParryHasteEnabled)
1970 {
1971 // Get attack timers
1972 float offtime = float(victim->getAttackTimer(OFF_ATTACK));
1973 float basetime = float(victim->getAttackTimer(BASE_ATTACK));
1974 // Reduce attack time
1975 if (victim->HasOffhandWeaponForAttack() && offtime < basetime)
1976 {
1977 float percent20 = victim->GetAttackTime(OFF_ATTACK) * 0.20f;
1978 float percent60 = 3.0f * percent20;
1979 if (offtime > percent20 && offtime <= percent60)
1980 victim->setAttackTimer(OFF_ATTACK, uint32(percent20));
1981 else if (offtime > percent60)
1982 {
1983 offtime -= 2.0f * percent20;
1984 victim->setAttackTimer(OFF_ATTACK, uint32(offtime));
1985 }
1986 }
1987 else
1988 {
1989 float percent20 = victim->GetAttackTime(BASE_ATTACK) * 0.20f;
1990 float percent60 = 3.0f * percent20;
1991 if (basetime > percent20 && basetime <= percent60)
1992 victim->setAttackTimer(BASE_ATTACK, uint32(percent20));
1993 else if (basetime > percent60)
1994 {
1995 basetime -= 2.0f * percent20;
1996 victim->setAttackTimer(BASE_ATTACK, uint32(basetime));
1997 }
1998 }
1999 }
2000
2001 for (uint8 i = 0; i < MAX_ITEM_PROTO_DAMAGES; ++i)
2002 {
2003 if (!canTakeMeleeDamage() || (!damageInfo->damages[i].damage && !damageInfo->damages[i].absorb && !damageInfo->damages[i].resist))
2004 {
2005 continue;
2006 }
2007
2008 // Call default DealDamage
2009 CleanDamage cleanDamage(damageInfo->cleanDamage, damageInfo->damages[i].absorb, damageInfo->attackType, damageInfo->hitOutCome);
2010 Unit::DealDamage(this, victim, damageInfo->damages[i].damage, &cleanDamage, DIRECT_DAMAGE, SpellSchoolMask(damageInfo->damages[i].damageSchoolMask), nullptr, durabilityLoss);
2011 }
2012
2013 // gain rage if attack is fully blocked, dodged or parried
2015 {
2016 switch (damageInfo->attackType)
2017 {
2018 case BASE_ATTACK:
2019 case OFF_ATTACK:
2020 {
2021 uint32 weaponSpeedHitFactor = uint32(GetAttackTime(damageInfo->attackType) / 1000.0f * (damageInfo->attackType == BASE_ATTACK ? 3.5f : 1.75f));
2022 RewardRage(damageInfo->cleanDamage, weaponSpeedHitFactor, true);
2023 break;
2024 }
2025 default:
2026 break;
2027 }
2028 }
2029
2030 // If this is a creature and it attacks from behind it has a probability to daze it's victim
2031 if ((damageInfo->damages[0].damage + damageInfo->damages[1].damage) && ((damageInfo->hitOutCome == MELEE_HIT_CRIT || damageInfo->hitOutCome == MELEE_HIT_CRUSHING || damageInfo->hitOutCome == MELEE_HIT_NORMAL || damageInfo->hitOutCome == MELEE_HIT_GLANCING) &&
2032 !IsPlayer() && !ToCreature()->IsControlledByPlayer() && !victim->HasInArc(M_PI, this)
2033 && (victim->IsPlayer() || !victim->ToCreature()->isWorldBoss()) && !victim->IsVehicle()))
2034 {
2035 // -probability is between 0% and 40%
2036 // 20% base chance
2037 float Probability = 20.0f;
2038
2039 // there is a newbie protection, at level 10 just 7% base chance; assuming linear function
2040 if (victim->GetLevel() < 30)
2041 Probability = 0.65f * victim->GetLevel() + 0.5f;
2042
2043 uint32 VictimDefense = victim->GetDefenseSkillValue();
2045 uint32 AttackerMeleeSkill = GetUnitMeleeSkill();
2046
2047 // xinef: fix daze mechanics
2048 Probability -= ((float)VictimDefense + (float)VictimAuraDefense - AttackerMeleeSkill) * 0.1428f;
2049
2050 if (Probability > 40.0f)
2051 Probability = 40.0f;
2052
2053 // Daze application
2054 if (sWorld->getBoolConfig(CONFIG_ENABLE_DAZE))
2055 if (roll_chance_f(std::max(0.0f, Probability)))
2056 CastSpell(victim, 1604, true);
2057 }
2058
2059 if (IsPlayer())
2060 {
2061 DamageInfo dmgInfo(*damageInfo);
2062 ToPlayer()->CastItemCombatSpell(victim, damageInfo->attackType, damageInfo->procVictim, dmgInfo.GetHitMask());
2063 }
2064
2065 // Do effect if any damage done to target
2066 if (damageInfo->damages[0].damage + damageInfo->damages[1].damage)
2067 DealDamageShieldDamage(victim);
2068}
@ CREATURE_FLAG_EXTRA_NO_PARRY_HASTEN
Definition CreatureData.h:48
@ EMOTE_ONESHOT_WOUND_CRITICAL
Definition SharedDefines.h:1935
@ EMOTE_ONESHOT_PARRY_SHIELD
Definition SharedDefines.h:1941
@ SPELL_AURA_MOD_ATTACKER_MELEE_CRIT_CHANCE
Definition SpellAuraDefines.h:250
@ CONFIG_ENABLE_DAZE
Definition WorldConfig.h:145
bool isWorldBoss() const
Definition Creature.h:124
void CastItemCombatSpell(Unit *target, WeaponAttackType attType, uint32 procVictim, uint32 procEx)
Definition Player.cpp:7230
uint32 GetUnitMeleeSkill(Unit const *target=nullptr) const
Definition Unit.h:1179
uint32 GetDefenseSkillValue(Unit const *target=nullptr) const
Definition Unit.cpp:3746
bool IsInFlight() const
Definition Unit.h:1689
void HandleEmoteCommand(uint32 emoteId)
Definition Unit.cpp:2124
bool HasFlagsExtra(uint32 flag) const
Definition CreatureData.h:279
bool HasInArc(float arcangle, const Position *pos, float targetRadius=0.0f) const
Definition Position.cpp:148

References CalcDamageInfo::absorb, CalcDamageInfo::attackType, BASE_ATTACK, CalcDamageInfo::blocked_amount, Player::CastItemCombatSpell(), CastSpell(), CalcDamageInfo::cleanDamage, CONFIG_ENABLE_DAZE, CREATURE_FLAG_EXTRA_NO_PARRY_HASTEN, CalcDamageInfo::damage, CalcDamageInfo::damages, CalcDamageInfo::damageSchoolMask, DealDamage(), DealDamageShieldDamage(), DIRECT_DAMAGE, EMOTE_ONESHOT_PARRY_SHIELD, EMOTE_ONESHOT_WOUND_CRITICAL, GetAttackTime(), getAttackTimer(), Creature::GetCreatureTemplate(), GetDefenseSkillValue(), DamageInfo::GetHitMask(), GetLevel(), GetTotalAuraModifier(), GetUnitMeleeSkill(), HandleEmoteCommand(), HasActivePowerType(), CreatureTemplate::HasFlagsExtra(), Position::HasInArc(), HasOffhandWeaponForAttack(), CalcDamageInfo::HitInfo, HITINFO_CRITICALHIT, CalcDamageInfo::hitOutCome, IsAlive(), IsControlledByPlayer(), Object::IsCreature(), Creature::IsEvadingAttacks(), IsInFlight(), Object::IsPlayer(), IsVehicle(), Creature::isWorldBoss(), MAX_ITEM_PROTO_DAMAGES, MELEE_HIT_CRIT, MELEE_HIT_CRUSHING, MELEE_HIT_GLANCING, MELEE_HIT_NORMAL, OFF_ATTACK, POWER_RAGE, CalcDamageInfo::procVictim, CalcDamageInfo::resist, RewardRage(), roll_chance_f(), setAttackTimer(), SPELL_AURA_MOD_ATTACKER_MELEE_CRIT_CHANCE, sWorld, CalcDamageInfo::target, CalcDamageInfo::TargetState, Object::ToCreature(), Object::ToPlayer(), VICTIMSTATE_BLOCKS, VICTIMSTATE_DODGE, and VICTIMSTATE_PARRY.

Referenced by AttackerStateUpdate(), and spell_dk_dancing_rune_weapon::HandleProc().

◆ DealSpellDamage()

void Unit::DealSpellDamage ( SpellNonMeleeDamage damageInfo,
bool  durabilityLoss,
Spell const *  spell = nullptr 
)
1579{
1580 if (damageInfo == 0)
1581 return;
1582
1583 Unit* victim = damageInfo->target;
1584
1585 if (!victim)
1586 return;
1587
1588 if (!victim->IsAlive() || victim->IsInFlight() || (victim->IsCreature() && victim->ToCreature()->IsEvadingAttacks()))
1589 return;
1590
1591 SpellInfo const* spellProto = damageInfo->spellInfo;
1592 if (!spellProto)
1593 {
1594 LOG_DEBUG("entities.unit", "Unit::DealSpellDamage has wrong damageInfo");
1595 return;
1596 }
1597
1598 // Call default DealDamage
1599 CleanDamage cleanDamage(damageInfo->cleanDamage, damageInfo->absorb, BASE_ATTACK, MELEE_HIT_NORMAL);
1600 Unit::DealDamage(this, victim, damageInfo->damage, &cleanDamage, SPELL_DIRECT_DAMAGE, SpellSchoolMask(damageInfo->schoolMask), spellProto, durabilityLoss, false, spell);
1601}
SpellInfo const * spellInfo
Definition Unit.h:510

References SpellNonMeleeDamage::absorb, BASE_ATTACK, SpellNonMeleeDamage::cleanDamage, SpellNonMeleeDamage::damage, DealDamage(), IsAlive(), Object::IsCreature(), Creature::IsEvadingAttacks(), IsInFlight(), LOG_DEBUG, MELEE_HIT_NORMAL, SpellNonMeleeDamage::schoolMask, SPELL_DIRECT_DAMAGE, SpellNonMeleeDamage::spellInfo, SpellNonMeleeDamage::target, and Object::ToCreature().

Referenced by Spell::DoAllEffectOnTarget(), spell_sindragosa_s_fury::HandleDummy(), AuraEffect::HandlePeriodicPowerBurnAuraTick(), and AuraEffect::HandleProcTriggerDamageAuraProc().

◆ DelayOwnedAuras()

void Unit::DelayOwnedAuras ( uint32  spellId,
ObjectGuid  caster,
int32  delaytime 
)
5688{
5689 AuraMapBoundsNonConst range = m_ownedAuras.equal_range(spellId);
5690 for (; range.first != range.second; ++range.first)
5691 {
5692 Aura* aura = range.first->second;
5693 if (!caster || aura->GetCasterGUID() == caster)
5694 {
5695 if (aura->GetDuration() < delaytime)
5696 aura->SetDuration(0);
5697 else
5698 aura->SetDuration(aura->GetDuration() - delaytime);
5699
5700 // update for out of range group members (on 1 slot use)
5702 LOG_DEBUG("spells.aura", "Aura {} partially interrupted on unit {}, new duration: {} ms", aura->GetId(), GetGUID().ToString(), aura->GetDuration());
5703 }
5704 }
5705}
int32 GetDuration() const
Definition SpellAuras.h:133
void SetNeedClientUpdateForTargets() const
Definition SpellAuras.cpp:1204
void SetDuration(int32 duration, bool withMods=false)
Definition SpellAuras.cpp:810
std::pair< AuraMap::iterator, AuraMap::iterator > AuraMapBoundsNonConst
Definition Unit.h:665

References Aura::GetCasterGUID(), Aura::GetDuration(), Object::GetGUID(), Aura::GetId(), LOG_DEBUG, m_ownedAuras, Aura::SetDuration(), Aura::SetNeedClientUpdateForTargets(), and Position::ToString().

◆ DeleteCharmInfo()

void Unit::DeleteCharmInfo ( )
12816{
12817 if (!m_charmInfo)
12818 return;
12819
12821 delete m_charmInfo;
12822 m_charmInfo = nullptr;
12823}
void RestoreState()
Definition CharmInfo.cpp:46

References m_charmInfo, and CharmInfo::RestoreState().

Referenced by RemoveCharmedBy().

◆ DeMorph()

void Unit::DeMorph ( )
4502{
4504}
virtual void SetDisplayId(uint32 modelId, float displayScale=1.f)
Definition Unit.cpp:13264
uint32 GetNativeDisplayId() const
Definition Unit.h:1959

References GetNativeDisplayId(), and SetDisplayId().

Referenced by modify_commandscript::HandleMorphResetCommand().

◆ DisableRotate()

void Unit::DisableRotate ( bool  apply)
14640{
14641 if (!IsCreature())
14642 return;
14643
14644 if (apply)
14648}
@ UNIT_STATE_POSSESSED
Definition UnitDefines.h:186
void SetUnitFlag(UnitFlags flags)
UnitFlags available in UnitDefines.h.
Definition Unit.h:742

References HasUnitState(), Object::IsCreature(), RemoveUnitFlag(), SetUnitFlag(), UNIT_FLAG_POSSESSED, and UNIT_STATE_POSSESSED.

Referenced by boss_ingvar_the_plunderer::DamageTaken(), boss_thorim::DisableThorim(), npc_black_knight_skeletal_gryphon::npc_black_knight_skeletal_gryphonAI::DoAction(), boss_yoggsaron_sara::EnableSara(), boss_anub_arak::EnterEvadeMode(), boss_devourer_of_souls::boss_devourer_of_soulsAI::EnterEvadeMode(), boss_garfrost::boss_garfrostAI::EnterEvadeMode(), boss_rotface::boss_rotfaceAI::EnterEvadeMode(), boss_varos::boss_varosAI::EnterEvadeMode(), boss_ignis::EnterEvadeMode(), boss_razorscale::EnterEvadeMode(), boss_ingvar_the_plunderer::EnterEvadeMode(), boss_garfrost::boss_garfrostAI::MovementInform(), boss_razorscale::MovementInform(), boss_devourer_of_souls::boss_devourer_of_soulsAI::Reset(), boss_garfrost::boss_garfrostAI::Reset(), boss_varos::boss_varosAI::Reset(), boss_ignis::Reset(), boss_kologarn::Reset(), boss_ingvar_the_plunderer::Reset(), boss_devourer_of_souls::boss_devourer_of_soulsAI::SpellHitTarget(), boss_anub_arak::UpdateAI(), boss_garfrost::boss_garfrostAI::UpdateAI(), boss_rotface::boss_rotfaceAI::UpdateAI(), boss_sindragosa::boss_sindragosaAI::UpdateAI(), boss_varos::boss_varosAI::UpdateAI(), boss_ignis::UpdateAI(), boss_razorscale::UpdateAI(), boss_ingvar_the_plunderer::UpdateAI(), and npc_black_knight_skeletal_gryphon::npc_black_knight_skeletal_gryphonAI::WaypointReached().

◆ DisableSpline()

◆ Dismount()

void Unit::Dismount ( )
10450{
10451 if (!IsMounted())
10452 return;
10453
10456
10457 if (Player* player = ToPlayer())
10458 {
10459 WorldPacket data(SMSG_MOVE_SET_COLLISION_HGT, GetPackGUID().size() + 4 + 4);
10460 data << GetPackGUID();
10461 data << player->GetSession()->GetOrderCounter(); // movement counter
10462 data << player->GetCollisionHeight();
10463 player->SendDirectMessage(&data);
10464 player->GetSession()->IncrementOrderCounter();
10465 }
10466
10467 WorldPacket data(SMSG_DISMOUNT, 8);
10468 data << GetPackGUID();
10469 SendMessageToSet(&data, true);
10470
10471 // dismount as a vehicle
10472 if (IsPlayer() && GetVehicleKit())
10473 {
10474 // Send other players that we are no longer a vehicle
10475 data.Initialize(SMSG_PLAYER_VEHICLE_DATA, 8 + 4);
10476 data << GetPackGUID();
10477 data << uint32(0);
10478 ToPlayer()->SendMessageToSet(&data, true);
10479 // Remove vehicle from player
10481 }
10482
10484
10485 // only resummon old pet if the player is already added to a map
10486 // this prevents adding a pet to a not created map which would otherwise cause a crash
10487 // (it could probably happen when logging in after a previous crash)
10488 if (Player* player = ToPlayer())
10489 {
10490 sScriptMgr->AnticheatSetUnderACKmount(player);
10491
10492 if (Pet* pPet = player->GetPet())
10493 {
10494 if (pPet->HasUnitFlag(UNIT_FLAG_STUNNED) && !pPet->HasUnitState(UNIT_STATE_STUNNED))
10495 pPet->RemoveUnitFlag(UNIT_FLAG_STUNNED);
10496 }
10497 else
10498 player->ResummonPetTemporaryUnSummonedIfAny();
10499
10500 // xinef: if we have charmed npc, remove stun also
10501 if (Unit* charm = player->GetCharm())
10502 if (charm->IsCreature() && !charm->HasUnitState(UNIT_STATE_STUNNED))
10503 charm->RemoveUnitFlag(UNIT_FLAG_STUNNED);
10504 }
10505}
@ AURA_INTERRUPT_FLAG_NOT_MOUNTED
Definition SpellDefines.h:49
@ UNIT_FLAG_STUNNED
Definition UnitDefines.h:272
@ UNIT_FLAG_MOUNT
Definition UnitDefines.h:281
@ UNIT_FIELD_MOUNTDISPLAYID
Definition UpdateFields.h:126
void SendMessageToSet(WorldPacket const *data, bool self) const override
Definition Player.cpp:5662
void RemoveVehicleKit()
Definition Unit.cpp:15093
@ SMSG_PLAYER_VEHICLE_DATA
Definition Opcodes.h:1221
@ SMSG_MOVE_SET_COLLISION_HGT
Definition Opcodes.h:1332
@ SMSG_DISMOUNT
Definition Opcodes.h:970

References AURA_INTERRUPT_FLAG_NOT_MOUNTED, GetCharm(), Object::GetPackGUID(), GetVehicleKit(), WorldPacket::Initialize(), IsMounted(), Object::IsPlayer(), RemoveAurasWithInterruptFlags(), RemoveUnitFlag(), RemoveVehicleKit(), WorldObject::SendMessageToSet(), Player::SendMessageToSet(), SetUInt32Value(), SMSG_DISMOUNT, SMSG_MOVE_SET_COLLISION_HGT, SMSG_PLAYER_VEHICLE_DATA, sScriptMgr, Object::ToPlayer(), UNIT_FIELD_MOUNTDISPLAYID, UNIT_FLAG_MOUNT, UNIT_FLAG_STUNNED, and UNIT_STATE_STUNNED.

Referenced by _EnterVehicle(), Player::CleanupAfterTaxiFlight(), FlightPathMovementGenerator::DoFinalize(), BattlegroundWS::EventPlayerClickedOnFlag(), AuraEffect::HandleAuraMounted(), WorldSession::HandleCancelMountAuraOpcode(), misc_commandscript::HandleDismountCommand(), spell_mount_check_aura::HandleEffectPeriodic(), npc_scarlet_courier::npc_scarlet_courierAI::JustEngagedWith(), boss_mandokir::boss_mandokirAI::JustEngagedWith(), npc_koltira_deathweaver::npc_koltira_deathweaverAI::MovementInform(), boss_captain_skarloc::MovementInform(), spell_chapter5_light_of_dawn_aura::OnApply(), Creature::setDeathState(), SetInCombatState(), npc_troll_volunteer::npc_troll_volunteerAI::SpellHit(), npc_magister_aledis::StartFight(), npc_thrall_old_hillsbrad::npc_thrall_old_hillsbradAI::UnMountSelf(), and npc_thrall_bfu::npc_thrall_bfuAI::UpdateAI().

◆ EnergizeBySpell()

void Unit::EnergizeBySpell ( Unit victim,
uint32  SpellID,
uint32  Damage,
Powers  powertype 
)
8264{
8265 int32 gainedPower = victim->ModifyPower(powerType, damage, false);
8266
8267 if (powerType != POWER_HAPPINESS && gainedPower)
8268 {
8269 SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellID);
8270 victim->getHostileRefMgr().threatAssist(this, float(gainedPower) * 0.5f, spellInfo);
8271 }
8272
8273 SendEnergizeSpellLog(victim, spellID, damage, powerType);
8274}
@ POWER_HAPPINESS
Definition SharedDefines.h:284
void threatAssist(Unit *victim, float baseThreat, SpellInfo const *threatSpell=nullptr)
Definition HostileRefMgr.cpp:35
void SendEnergizeSpellLog(Unit *victim, uint32 SpellID, uint32 Damage, Powers powertype)
Definition Unit.cpp:8252

References getHostileRefMgr(), ModifyPower(), POWER_HAPPINESS, SendEnergizeSpellLog(), sSpellMgr, and HostileRefMgr::threatAssist().

Referenced by Spell::EffectEnergize(), Spell::EffectEnergizePct(), Spell::EffectPowerDrain(), and AuraEffect::HandlePeriodicTriggerSpellAuraTick().

◆ EnterVehicle()

void Unit::EnterVehicle ( Unit base,
int8  seatId = -1 
)
15737{
15739
15740 if (Player* player = ToPlayer())
15741 {
15742 sScriptMgr->AnticheatSetUnderACKmount(player);
15743 }
15744}
@ TRIGGERED_IGNORE_CASTER_MOUNTED_OR_ON_VEHICLE
Will ignore caster aura states including combat requirements and death state.
Definition SpellDefines.h:146
@ VEHICLE_SPELL_RIDE_HARDCODED
Definition VehicleDefines.h:52

References CastCustomSpell(), SPELLVALUE_BASE_POINT0, sScriptMgr, Object::ToPlayer(), TRIGGERED_IGNORE_CASTER_MOUNTED_OR_ON_VEHICLE, and VEHICLE_SPELL_RIDE_HARDCODED.

Referenced by debug_commandscript::HandleDebugEnterVehicleCommand(), WorldSession::HandleEnterPlayerVehicle(), boss_mimiron::JustEngagedWith(), npc_pilgrims_bounty_chair::UpdateAI(), and boss_mimiron::UpdateAI().

◆ EnterVehicleUnattackable()

void Unit::EnterVehicleUnattackable ( Unit base,
int8  seatId = -1 
)

◆ ExecuteDelayedUnitAINotifyEvent()

void Unit::ExecuteDelayedUnitAINotifyEvent ( )
16599{
16601 if (!this->IsInWorld() || this->IsDuringRemoveFromWorld())
16602 return;
16603
16604 Acore::AIRelocationNotifier notifier(*this);
16605 float radius = 60.0f;
16606 Cell::VisitObjects(this, notifier, radius);
16607}
@ NOTIFY_AI_RELOCATION
Definition Object.h:69
void RemoveFromNotify(uint16 f)
Definition Object.h:659
Definition GridNotifiers.h:91
static void VisitObjects(WorldObject const *obj, T &visitor, float radius)
Definition CellImpl.h:165

References IsDuringRemoveFromWorld(), Object::IsInWorld(), NOTIFY_AI_RELOCATION, WorldObject::RemoveFromNotify(), and Cell::VisitObjects().

Referenced by Update().

◆ ExecuteDelayedUnitRelocationEvent()

void Unit::ExecuteDelayedUnitRelocationEvent ( )
16498{
16500 if (!this->IsInWorld() || this->IsDuringRemoveFromWorld())
16501 return;
16502
16503 if (this->HasSharedVision())
16504 for (SharedVisionList::const_iterator itr = this->GetSharedVisionList().begin(); itr != this->GetSharedVisionList().end(); ++itr)
16505 if (Player* player = (*itr))
16506 {
16507 if (player->IsOnVehicle(this) || !player->IsInWorld() || player->IsDuringRemoveFromWorld()) // players on vehicles have their own event executed (due to passenger relocation)
16508 continue;
16509 WorldObject* viewPoint = player;
16510 if (player->m_seer && player->m_seer->IsInWorld())
16511 viewPoint = player->m_seer;
16512 if (!viewPoint->IsPositionValid() || !player->IsPositionValid())
16513 continue;
16514
16515 if (Unit* active = viewPoint->ToUnit())
16516 {
16517 //if (active->IsVehicle()) // always check original unit here, last notify position is not relocated
16518 // active = player;
16519
16520 float dx = active->m_last_notify_position.GetPositionX() - active->GetPositionX();
16521 float dy = active->m_last_notify_position.GetPositionY() - active->GetPositionY();
16522 float dz = active->m_last_notify_position.GetPositionZ() - active->GetPositionZ();
16523 float distsq = dx * dx + dy * dy + dz * dz;
16524 float mindistsq = DynamicVisibilityMgr::GetReqMoveDistSq(active->FindMap()->GetEntry()->map_type);
16525 if (distsq < mindistsq)
16526 continue;
16527
16528 // this will be relocated below sharedvision!
16529 //active->m_last_notify_position.Relocate(active->GetPositionX(), active->GetPositionY(), active->GetPositionZ());
16530 }
16531
16532 Acore::PlayerRelocationNotifier notifier(*player);
16533 Cell::VisitObjects(viewPoint, notifier, player->GetSightRange());
16535 notifier.SendToSelf();
16536 }
16537
16538 if (Player* player = this->ToPlayer())
16539 {
16540 WorldObject* viewPoint = player;
16541 if (player->m_seer && player->m_seer->IsInWorld())
16542 viewPoint = player->m_seer;
16543
16544 if (viewPoint->GetMapId() != player->GetMapId() || !viewPoint->IsPositionValid() || !player->IsPositionValid())
16545 return;
16546
16547 if (Unit* active = viewPoint->ToUnit())
16548 {
16549 if (active->IsVehicle())
16550 active = player;
16551
16552 if (!player->GetFarSightDistance())
16553 {
16554 float dx = active->m_last_notify_position.GetPositionX() - active->GetPositionX();
16555 float dy = active->m_last_notify_position.GetPositionY() - active->GetPositionY();
16556 float dz = active->m_last_notify_position.GetPositionZ() - active->GetPositionZ();
16557 float distsq = dx * dx + dy * dy + dz * dz;
16558
16559 float mindistsq = DynamicVisibilityMgr::GetReqMoveDistSq(active->FindMap()->GetEntry()->map_type);
16560 if (distsq < mindistsq)
16561 return;
16562
16563 active->m_last_notify_position.Relocate(active->GetPositionX(), active->GetPositionY(), active->GetPositionZ());
16564 }
16565 }
16566
16568
16569 Acore::PlayerRelocationNotifier notifier(*player);
16570 Cell::VisitObjects(viewPoint, notifier, player->GetSightRange());
16572 notifier.SendToSelf();
16573
16575 }
16576 else if (Creature* unit = this->ToCreature())
16577 {
16578 if (!unit->IsPositionValid())
16579 return;
16580
16581 float dx = unit->m_last_notify_position.GetPositionX() - unit->GetPositionX();
16582 float dy = unit->m_last_notify_position.GetPositionY() - unit->GetPositionY();
16583 float dz = unit->m_last_notify_position.GetPositionZ() - unit->GetPositionZ();
16584 float distsq = dx * dx + dy * dy + dz * dz;
16585 float mindistsq = DynamicVisibilityMgr::GetReqMoveDistSq(unit->FindMap()->GetEntry()->map_type);
16586 if (distsq < mindistsq)
16587 return;
16588
16589 unit->m_last_notify_position.Relocate(unit->GetPositionX(), unit->GetPositionY(), unit->GetPositionZ());
16590
16591 Acore::CreatureRelocationNotifier relocate(*unit);
16592 Cell::VisitObjects(unit, relocate, unit->GetVisibilityRange());
16593
16595 }
16596}
#define MAX_VISIBILITY_DISTANCE
Definition ObjectDefines.h:30
#define VISIBILITY_DISTANCE_GIGANTIC
Definition ObjectDefines.h:34
@ NOTIFY_VISIBILITY_CHANGED
Definition Object.h:70
static float GetReqMoveDistSq(uint32 map_type)
Definition DynamicVisibility.h:53
void LoadGridsInRange(Position const &center, float radius)
Definition Map.cpp:226
Unit * ToUnit()
Definition Object.h:209
SharedVisionList const & GetSharedVisionList()
Definition Unit.h:1860
bool HasSharedVision() const
Definition Unit.h:1863
uint32 GetMapId() const
Definition Position.h:281
Definition Object.h:471
void AddToNotify(uint16 f)
Definition Object.cpp:2990
Definition GridNotifiers.h:83
Definition GridNotifiers.h:74
static void VisitFarVisibleObjects(WorldObject const *obj, T &visitor, float radius)
Definition CellImpl.h:185
bool IsPositionValid() const
Definition Position.cpp:183

References WorldObject::AddToNotify(), WorldObject::GetMap(), WorldLocation::GetMapId(), Position::GetPositionX(), DynamicVisibilityMgr::GetReqMoveDistSq(), GetSharedVisionList(), HasSharedVision(), IsDuringRemoveFromWorld(), Object::IsInWorld(), Position::IsPositionValid(), Map::LoadGridsInRange(), MAX_VISIBILITY_DISTANCE, NOTIFY_AI_RELOCATION, NOTIFY_VISIBILITY_CHANGED, WorldObject::RemoveFromNotify(), Acore::VisibleNotifier::SendToSelf(), Object::ToCreature(), Object::ToPlayer(), Object::ToUnit(), VISIBILITY_DISTANCE_GIGANTIC, Cell::VisitFarVisibleObjects(), and Cell::VisitObjects().

◆ ExitVehicle()

void Unit::ExitVehicle ( Position const *  exitPosition = nullptr)

This function can be called at upper level code to initialize an exit from the passenger's side.

The following call would not even be executed successfully as the SPELL_AURA_CONTROL_VEHICLE unapply handler already calls _ExitVehicle without specifying an exitposition. The subsequent call below would return on if (!m_vehicle).

To do: We need to allow SPELL_AURA_CONTROL_VEHICLE unapply handlers in spellscripts to specify exit coordinates and either store those per passenger, or we need to init spline movement based on those coordinates in unapply handlers, and relocate exiting passengers based on Unit::moveSpline data. Either way, Coming Soon(TM)

15833{
15835 if (!m_vehicle)
15836 return;
15837
15839 if (Player* player = ToPlayer())
15840 {
15841 player->SetCanTeleport(true);
15842 }
15846 /*_ExitVehicle(exitPosition);*/
15853
15854 if (Player* player = ToPlayer())
15855 {
15856 sScriptMgr->AnticheatSetUnderACKmount(player);
15857 }
15858}
Unit * GetVehicleBase() const
Definition Unit.cpp:15108

References Object::GetGUID(), GetVehicleBase(), m_vehicle, RemoveAurasByType(), SPELL_AURA_CONTROL_VEHICLE, sScriptMgr, and Object::ToPlayer().

Referenced by _EnterVehicle(), Player::ActivateTaxiPathTo(), MotionTransport::DelayedTeleportTransport(), boss_mimiron::EnterEvadeMode(), npc_ulduar_leviathan_mkii::EnterEvadeMode(), npc_ulduar_vx001::EnterEvadeMode(), npc_ulduar_aerial_command_unit::EnterEvadeMode(), WorldSession::HandleDismissControlledVehicle(), spell_warhead_detonate::HandleDummy(), WorldSession::HandleEjectPassenger(), spell_ulduar_squeezed_lifeless::HandleInstaKill(), WorldSession::HandleRequestVehicleExit(), spell_vehicle_throw_passenger::HandleScript(), boss_kologarn_arms::JustDied(), spell_dragonblight_devour_ghoul_periodic::OnRemove(), Player::ProcessDelayedOperations(), RemoveFromWorld(), Player::StopCastingCharm(), and Player::TeleportTo().

◆ FindCurrentSpellBySpellId()

◆ FinishSpell()

void Unit::FinishSpell ( CurrentSpellTypes  spellType,
bool  ok = true 
)
4231{
4232 Spell* spell = m_currentSpells[spellType];
4233 if (!spell)
4234 return;
4235
4236 if (spellType == CURRENT_CHANNELED_SPELL)
4237 spell->SendChannelUpdate(0);
4238
4239 spell->finish(ok);
4240}
void SendChannelUpdate(uint32 time)
Definition Spell.cpp:5131

References CURRENT_CHANNELED_SPELL, Spell::finish(), m_currentSpells, and Spell::SendChannelUpdate().

Referenced by AuraEffect::HandleFeignDeath(), AuraEffect::HandleModStealth(), npc_risen_archmage::npc_risen_archmageAI::JustEngagedWith(), boss_lord_marrowgar::UpdateAI(), and GameObject::Use().

◆ GetAffectingPlayer()

Player * Unit::GetAffectingPlayer ( ) const
7615{
7616 if (!GetCharmerOrOwnerGUID())
7617 return const_cast<Unit*>(this)->ToPlayer();
7618
7619 if (Unit* owner = GetCharmerOrOwner())
7621
7622 return nullptr;
7623}
ObjectGuid GetCharmerOrOwnerGUID() const
Definition Unit.h:1284

References GetCharmerOrOwner(), GetCharmerOrOwnerGUID(), GetCharmerOrOwnerPlayerOrPlayerItself(), and Object::ToPlayer().

Referenced by _IsValidAssistTarget(), _IsValidAttackTarget(), GetDispellableAuraList(), GetFactionReactionTo(), and GetReactionTo().

◆ GetAI()

UnitAI * Unit::GetAI ( )
inline
687{ return i_AI; }

References i_AI.

Referenced by CalculateMeleeDamage(), CalculateSpellDamageTaken(), spell_algalon_big_bang::CheckTargets(), DealDamage(), DealHeal(), spell_send_mug_target_picker::FilterTargets(), spell_blood_queen_bloodbolt::FilterTargets(), spell_kologarn_focused_eyebeam::FilterTargetsInitial(), npc_dream_fog::npc_dream_fogAI::GetRandomUnitFromDragonThreatList(), WorldState::HandleActiveZone(), BattlegroundIC::HandleCapturedNodes(), spell_send_mug_target_picker::HandleDummy(), spell_fatal_strike::HandleDummy(), spell_magtheridon_shadow_grasp_visual::HandleDummyApply(), spell_mount_check_aura::HandleEffectPeriodic(), spell_tharon_ja_dummy_aura::HandleEffectRemove(), spell_mirkblood_blood_mirror_target_picker::HandleHit(), spell_random_aggro::HandleOnHit(), spell_shadow_sickle_periodic_damage::HandlePeriodic(), spell_grip::HandlePeriodic(), spell_kiljaeden_armageddon_periodic_aura::HandlePeriodic(), AuraEffect::HandlePeriodicDamageAurasTick(), AuraEffect::HandlePeriodicHealAurasTick(), AuraEffect::HandlePeriodicHealthLeechAuraTick(), spell_frostwarden_handler_focus_fire::HandleScript(), spell_ayamiss_swarmer_start_loop::HandleScript(), spell_pursue::HandleScript(), spell_xt002_gravity_bomb_damage::HandleScript(), spell_the_lich_king_quake::HandleSendEvent(), spell_black_knight_ghoul_claw::HandleSpellHit(), npc_risen_guardian::npc_risen_guardianAI::IsSummonedBy(), npc_risen_guardian::npc_risen_guardianAI::KilledUnit(), ModifyPower(), npc_marzon_silent_blade::npc_marzon_silent_bladeAI::MovementInform(), npc_pet_mage_mirror_image::MySelectNextTarget(), spell_claw_swipe_check::OnApply(), achievement_respect_your_elders::OnCheck(), achievement_hadronox_denied::OnCheck(), achievement_watch_him_die::OnCheck(), achievement_better_off_dred::OnCheck(), achievement_oh_novos::OnCheck(), achievement_share_the_love::OnCheck(), achievement_snakes_whyd_it_have_to_be_snakes::OnCheck(), achievement_im_on_a_boat::OnCheck(), achievement_all_you_can_eat::OnCheck(), achievement_been_waiting_long_time::OnCheck(), achievement_neck_deep_in_vile::OnCheck(), achievement_portal_jockey::OnCheck(), achievement_chaos_theory::OnCheck(), achievement_split_personality::OnCheck(), achievement_algalon_he_feeds_on_your_tears::OnCheck(), achievement_algalon_herald_of_the_titans::OnCheck(), achievement_flame_leviathan_towers::OnCheck(), achievement_flame_leviathan_shutout::OnCheck(), achievement_freya_getting_back_to_nature::OnCheck(), achievement_freya_knock_on_wood::OnCheck(), achievement_yogg_saron_drive_me_crazy::OnCheck(), achievement_yogg_saron_kiss_and_make_up::OnCheck(), achievement_intense_cold::OnCheck(), achievement_once_bitten_twice_shy::OnCheck(), spell_xt002_gravity_bomb_aura::OnPeriodic(), spell_grip::OnRemove(), spell_claw_swipe_check::OnRemove(), npc_dark_fiend::Reset(), spell_marrowgar_coldflame::SelectTarget(), and boss_yoggsaron_immortal_guardian::SpellHit().

◆ GetAllMinionsByEntry()

void Unit::GetAllMinionsByEntry ( std::list< Creature * > &  Minions,
uint32  entry 
)
7841{
7842 for (Unit::ControlSet::iterator itr = m_Controlled.begin(); itr != m_Controlled.end();)
7843 {
7844 Unit* unit = *itr;
7845 ++itr;
7846 if (unit->GetEntry() == entry && unit->IsCreature()
7847 && unit->ToCreature()->IsSummon()) // minion, actually
7848 Minions.push_back(unit->ToCreature());
7849 }
7850}
bool IsSummon() const
Definition Unit.h:788

References Object::GetEntry(), Object::IsCreature(), IsSummon(), m_Controlled, and Object::ToCreature().

Referenced by spell_item_gift_of_the_harvester::CheckRequirement().

◆ GetAPMultiplier()

float Unit::GetAPMultiplier ( WeaponAttackType  attType,
bool  normalized 
)
13733{
13734 if (!normalized || !IsPlayer())
13735 return float(GetAttackTime(attType)) / 1000.0f;
13736
13737 Item* Weapon = ToPlayer()->GetWeaponForAttack(attType, true);
13738 if (!Weapon)
13739 return 2.4f; // fist attack
13740
13741 switch (Weapon->GetTemplate()->InventoryType)
13742 {
13743 case INVTYPE_2HWEAPON:
13744 return 3.3f;
13745 case INVTYPE_RANGED:
13747 case INVTYPE_THROWN:
13748 return 2.8f;
13749 case INVTYPE_WEAPON:
13752 default:
13753 return Weapon->GetTemplate()->SubClass == ITEM_SUBCLASS_WEAPON_DAGGER ? 1.7f : 2.4f;
13754 }
13755}
@ ITEM_SUBCLASS_WEAPON_DAGGER
Definition ItemTemplate.h:359
@ INVTYPE_RANGED
Definition ItemTemplate.h:271
@ INVTYPE_THROWN
Definition ItemTemplate.h:281
@ INVTYPE_RANGEDRIGHT
Definition ItemTemplate.h:282
@ INVTYPE_WEAPON
Definition ItemTemplate.h:269
@ INVTYPE_WEAPONMAINHAND
Definition ItemTemplate.h:277
@ INVTYPE_WEAPONOFFHAND
Definition ItemTemplate.h:278
@ INVTYPE_2HWEAPON
Definition ItemTemplate.h:273
Weapon
Definition boss_arlokk.cpp:67
Definition Item.h:220
ItemTemplate const * GetTemplate() const
Definition Item.cpp:544
Item * GetWeaponForAttack(WeaponAttackType attackType, bool useable=false) const
Definition PlayerStorage.cpp:490
uint32 SubClass
Definition ItemTemplate.h:622

References GetAttackTime(), Item::GetTemplate(), Player::GetWeaponForAttack(), INVTYPE_2HWEAPON, INVTYPE_RANGED, INVTYPE_RANGEDRIGHT, INVTYPE_THROWN, INVTYPE_WEAPON, INVTYPE_WEAPONMAINHAND, INVTYPE_WEAPONOFFHAND, Object::IsPlayer(), ITEM_SUBCLASS_WEAPON_DAGGER, ItemTemplate::SubClass, and Object::ToPlayer().

Referenced by Creature::CalculateMinMaxDamage(), Player::CalculateMinMaxDamage(), and MeleeDamageBonusDone().

◆ GetAppliedAuras() [1/2]

◆ GetAppliedAuras() [2/2]

AuraApplicationMap const & Unit::GetAppliedAuras ( ) const
inline
1373{ return m_appliedAuras; }

References m_appliedAuras.

◆ GetArmor()

◆ getAttackerForHelper()

Unit * Unit::getAttackerForHelper ( ) const
863{
864 if (GetVictim() != nullptr)
865 return GetVictim();
866
867 if (!IsEngaged())
868 return nullptr;
869
870 if (!m_attackers.empty())
871 return *(m_attackers.begin());
872
873 return nullptr;
874}
bool IsEngaged() const
Definition Unit.h:925

References GetVictim(), IsEngaged(), and m_attackers.

Referenced by Creature::_IsTargetAcceptable(), npc_clintar_spirit::npc_clintar_spiritAI::EnterEvadeMode(), PetAI::SelectNextTarget(), Creature::SelectVictim(), SetControlled(), TotemAI::UpdateAI(), npc_clintar_spirit::npc_clintar_spiritAI::UpdateAI(), and PetAI::UpdateAI().

◆ getAttackers()

◆ GetAttackTime()

◆ getAttackTimer()

◆ GetAura()

Aura * Unit::GetAura ( uint32  spellId,
ObjectGuid  casterGUID = ObjectGuid::Empty,
ObjectGuid  itemCasterGUID = ObjectGuid::Empty,
uint8  reqEffMask = 0 
) const
5807{
5808 AuraApplication* aurApp = GetAuraApplication(spellId, casterGUID, itemCasterGUID, reqEffMask);
5809 return aurApp ? aurApp->GetBase() : nullptr;
5810}
AuraApplication * GetAuraApplication(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint8 reqEffMask=0, AuraApplication *except=nullptr) const
Definition Unit.cpp:5787

References GetAuraApplication(), and AuraApplication::GetBase().

Referenced by Player::_addSpell(), Pet::addSpell(), Player::ApplyEquipCooldown(), spell_mage_burning_determination::CheckProc(), npc_ulduar_iron_construct::DamageTaken(), boss_deathbringer_saurfang::boss_deathbringer_saurfangAI::DoAction(), boss_freya::DoAction(), Spell::DoTriggersOnSpellHit(), Spell::EffectScriptEffect(), Spell::EffectTitanGrip(), Spell::EffectWeaponDmg(), getOrphanGUID(), spell_dk_scourge_strike::HandleAfterHit(), spell_warl_seduction::HandleAuraApply(), AuraEffect::HandleAuraDummy(), AuraEffect::HandleAuraLinked(), Aura::HandleAuraSpecificMods(), misc_commandscript::HandleAuraStacksCommand(), deserter_commandscript::HandleDeserterAdd(), deserter_commandscript::HandleDeserterRemove(), deserter_commandscript::HandleDeserterRemoveAll(), spell_karazhan_wrath_titans_stacker::HandleDummy(), spell_charge_shield_bomber::HandleDummy(), spell_ahn_kahet_swarmer_aura::HandleDummy(), spell_item_pygmy_oil::HandleDummy(), spell_yogg_saron_sanity_well_aura::HandleEffectPeriodic(), spell_brewfest_main_ram_buff::HandleEffectPeriodic(), spell_hodir_flash_freeze_aura::HandleEffectPeriodic(), spell_sindragosa_frost_breath::HandleInfusion(), spell_warr_extra_proc::HandleProc(), spell_dk_blood_caked_blade::HandleProc(), spell_item_trinket_stack< StackSpell, TriggerSpell >::HandleProc(), spell_item_tiny_abomination_in_a_jar::HandleProc(), spell_item_tiny_abomination_in_a_jar_hero::HandleProc(), AuraEffect::HandleRaidProcFromChargeWithValueAuraProc(), spell_putricide_unstable_experiment::HandleScript(), spell_festergut_gastric_bloat::HandleScript(), spell_putricide_eat_ooze::HandleScript(), spell_rotface_large_ooze_combine::HandleScript(), spell_yogg_saron_sanity_reduce::HandleScriptEffect(), spell_dk_pestilence::HandleScriptEffect(), spell_pri_lightwell::HandleScriptEffect(), npc_pet_dk_ebon_gargoyle::InitializeAI(), npc_spiritual_insight::npc_spiritual_insightAI::IsSummonedBy(), npc_gunship::npc_gunshipAI::JustDied(), boss_high_nethermancer_zerevor::JustEngagedWith(), npc_brew_bubble::MoveInLineOfSight(), npc_brewfest_keg_reciver::MoveInLineOfSight(), npc_air_force_bots::npc_air_force_botsAI::MoveInLineOfSight(), spell_summoning_rhyme_aura::PeriodicTick(), Player::ProcessDelayedOperations(), BattlefieldWG::PromotePlayer(), RemoveAurasDueToSpellBySteal(), Player::ResurrectPlayer(), SetAuraStack(), boss_anomalus::SetData(), npc_ulduar_iron_construct::SpellHit(), npc_pilgrims_bounty_chair::SpellHit(), boss_jaraxxus::boss_jaraxxusAI::SpellHit(), boss_sindragosa::boss_sindragosaAI::SpellHitTarget(), npc_ulduar_hodir_shaman::SpellHitTarget(), boss_yoggsaron_sara::SpellHitTarget(), npc_twilight_summon::UpdateAI(), boss_lord_marrowgar::UpdateAI(), boss_freya::UpdateAI(), boss_freya_elder_brightleaf::UpdateAI(), npc_ulduar_iron_construct::UpdateAI(), npc_tournament_training_dummy::npc_tournament_training_dummyAI::UpdateAI(), and Player::UpdateTitansGrip().

◆ GetAuraApplication()

AuraApplication * Unit::GetAuraApplication ( uint32  spellId,
ObjectGuid  casterGUID = ObjectGuid::Empty,
ObjectGuid  itemCasterGUID = ObjectGuid::Empty,
uint8  reqEffMask = 0,
AuraApplication except = nullptr 
) const
5788{
5789 AuraApplicationMapBounds range = m_appliedAuras.equal_range(spellId);
5790 for (; range.first != range.second; ++range.first)
5791 {
5792 AuraApplication* app = range.first->second;
5793 Aura const* aura = app->GetBase();
5794
5795 if (((aura->GetEffectMask() & reqEffMask) == reqEffMask)
5796 && (!casterGUID || aura->GetCasterGUID() == casterGUID)
5797 && (!itemCasterGUID || aura->GetCastItemGUID() == itemCasterGUID)
5798 && (!except || except != app))
5799 {
5800 return app;
5801 }
5802 }
5803 return nullptr;
5804}
uint8 GetEffectMask() const
Definition SpellAuras.h:177
ObjectGuid GetCastItemGUID() const
Definition SpellAuras.h:103
std::pair< AuraApplicationMap::const_iterator, AuraApplicationMap::const_iterator > AuraApplicationMapBounds
Definition Unit.h:668

References AuraApplication::GetBase(), Aura::GetCasterGUID(), Aura::GetCastItemGUID(), Aura::GetEffectMask(), and m_appliedAuras.

Referenced by AuraApplication::_Remove(), GetAura(), GetAuraApplicationOfRankedSpell(), HasAura(), and Spell::UpdateChanneledTargetList().

◆ GetAuraApplicationOfRankedSpell()

AuraApplication * Unit::GetAuraApplicationOfRankedSpell ( uint32  spellId,
ObjectGuid  casterGUID = ObjectGuid::Empty,
ObjectGuid  itemCasterGUID = ObjectGuid::Empty,
uint8  reqEffMask = 0,
AuraApplication except = nullptr 
) const
5813{
5814 uint32 rankSpell = sSpellMgr->GetFirstSpellInChain(spellId);
5815 while (rankSpell)
5816 {
5817 if (AuraApplication* aurApp = GetAuraApplication(rankSpell, casterGUID, itemCasterGUID, reqEffMask, except))
5818 return aurApp;
5819 rankSpell = sSpellMgr->GetNextSpellInChain(rankSpell);
5820 }
5821 return nullptr;
5822}

References GetAuraApplication(), and sSpellMgr.

Referenced by spell_warl_drain_soul::CheckProc(), spell_warl_improved_drain_soul::CheckProc(), and GetAuraOfRankedSpell().

◆ GetAuraCount()

uint32 Unit::GetAuraCount ( uint32  spellId) const
5908{
5909 uint32 count = 0;
5910 AuraApplicationMapBounds range = m_appliedAuras.equal_range(spellId);
5911
5912 for (AuraApplicationMap::const_iterator itr = range.first; itr != range.second; ++itr)
5913 {
5914 if (itr->second->GetBase()->GetStackAmount() == 0)
5915 ++count;
5916 else
5917 count += (uint32)itr->second->GetBase()->GetStackAmount();
5918 }
5919
5920 return count;
5921}

References m_appliedAuras.

Referenced by npc_brew_bubble::MoveInLineOfSight(), spell_valithria_suppression_aura::OnApply(), achievement_consumption_junction::OnCheck(), achievement_assembly_of_iron::OnCheck(), achievement_cant_do_that_while_stunned::OnCheck(), spell_valithria_suppression_aura::OnRemove(), SmartScript::ProcessEvent(), boss_pyroguard_emberseer::boss_pyroguard_emberseerAI::SpellHit(), spell_black_temple_spell_absorption_aura::Update(), and npc_infra_green_bomber_generic::npc_infra_green_bomber_genericAI::UpdateAI().

◆ GetAuraEffect() [1/3]

AuraEffect * Unit::GetAuraEffect ( AuraType  type,
SpellFamilyNames  family,
uint32  familyFlag1,
uint32  familyFlag2,
uint32  familyFlag3,
ObjectGuid  casterGUID = ObjectGuid::Empty 
) const
5760{
5761 AuraEffectList const& auras = GetAuraEffectsByType(type);
5762 for (AuraEffectList::const_iterator i = auras.begin(); i != auras.end(); ++i)
5763 {
5764 SpellInfo const* spell = (*i)->GetSpellInfo();
5765 if (spell->SpellFamilyName == uint32(family) && spell->SpellFamilyFlags.HasFlag(familyFlag1, familyFlag2, familyFlag3))
5766 {
5767 if (casterGUID && (*i)->GetCasterGUID() != casterGUID)
5768 continue;
5769 return (*i);
5770 }
5771 }
5772 return nullptr;
5773}
flag96 SpellFamilyFlags
Definition SpellInfo.h:388
uint32 SpellFamilyName
Definition SpellInfo.h:387
bool HasFlag(uint32 p1=0, uint32 p2=0, uint32 p3=0) const
Definition Util.h:459

References GetAuraEffectsByType(), flag96::HasFlag(), SpellInfo::SpellFamilyFlags, and SpellInfo::SpellFamilyName.

◆ GetAuraEffect() [2/3]

AuraEffect * Unit::GetAuraEffect ( AuraType  type,
SpellFamilyNames  name,
uint32  iconId,
uint8  effIndex 
) const
5746{
5747 AuraEffectList const& auras = GetAuraEffectsByType(type);
5748 for (Unit::AuraEffectList::const_iterator itr = auras.begin(); itr != auras.end(); ++itr)
5749 {
5750 if (effIndex != (*itr)->GetEffIndex())
5751 continue;
5752 SpellInfo const* spell = (*itr)->GetSpellInfo();
5753 if (spell->SpellIconID == iconId && spell->SpellFamilyName == name)
5754 return *itr;
5755 }
5756 return nullptr;
5757}
uint32 SpellIconID
Definition SpellInfo.h:380

References GetAuraEffectsByType(), SpellInfo::SpellFamilyName, and SpellInfo::SpellIconID.

◆ GetAuraEffect() [3/3]

AuraEffect * Unit::GetAuraEffect ( uint32  spellId,
uint8  effIndex,
ObjectGuid  casterGUID = ObjectGuid::Empty 
) const
5720{
5721 AuraApplicationMapBounds range = m_appliedAuras.equal_range(spellId);
5722 for (AuraApplicationMap::const_iterator itr = range.first; itr != range.second; ++itr)
5723 {
5724 if (itr->second->HasEffect(effIndex)
5725 && (!caster || itr->second->GetBase()->GetCasterGUID() == caster))
5726 {
5727 return itr->second->GetBase()->GetEffect(effIndex);
5728 }
5729 }
5730 return nullptr;
5731}

References AuraEffect::GetBase(), Aura::GetEffect(), and m_appliedAuras.

Referenced by CalculateSpellAmount(), spell_mage_ice_barrier::CheckCast(), spell_pri_power_word_shield::CheckCast(), spell_mage_molten_armor::CheckProc(), spell_mage_missile_barrage_proc::CheckProc(), Spell::EffectHeal(), Spell::EffectSchoolDMG(), Spell::EffectWeaponDmg(), GetAuraEffectOfRankedSpell(), GetDummyAuraEffect(), AuraEffect::HandleAuraModShapeshift(), Aura::HandleAuraSpecificMods(), spell_sha_maelstrom_weapon::HandleBonus(), spell_dk_raise_ally::HandleDummy(), spell_dk_death_coil::HandleDummy(), spell_dk_death_strike::HandleDummy(), spell_dk_scourge_strike::HandleDummy(), spell_warl_life_tap::HandleDummy(), spell_warr_execute::HandleEffect(), spell_dru_nourish::HandleHeal(), AuraEffect::HandlePeriodicHealAurasTick(), spell_pal_sacred_shield_dummy::HandleProc(), spell_warr_extra_proc::HandleProc(), spell_dk_unholy_blight::HandleProc(), spell_dru_glyph_of_shred::HandleProc(), spell_hun_thrill_of_the_hunt::HandleProc(), spell_item_blessing_of_ancient_kings::HandleProc(), spell_item_persistent_shield::HandleProc(), spell_pal_infusion_of_light::HandleProc(), spell_pri_divine_aegis::HandleProc(), spell_rog_glyph_of_backstab::HandleProc(), spell_sha_glyph_of_earth_shield::HandleProc(), spell_sha_imp_water_shield::HandleProc(), spell_sha_static_shock::HandleProc(), spell_sha_t10_elemental_4p_bonus::HandleProc(), spell_dk_glyph_of_scourge_strike_script::HandleScriptEffect(), spell_sha_stoneclaw_totem::HandleScriptEffect(), spell_pal_seal_of_vengeance_aura::HandleSeal(), AuraEffect::HandleShapeshiftBoosts(), spell_warl_drain_soul::HandleTick(), npc_pet_dk_ebon_gargoyle::InitializeAI(), Guardian::InitStatsForLevel(), npc_anzu_spirit::IsSummonedBy(), ModSpellDuration(), spell_dk_death_and_decay::RecalculateDamage(), RemoveAurasDueToSpellByDispel(), SpellDamageBonusDone(), SpellHealingBonusTaken(), npc_soh_fire_trigger::SpellHit(), npc_hallows_end_train_fire::SpellHit(), SpellPctDamageModsDone(), SpellPctHealingModsDone(), SpellTakenCritChance(), spell_mage_incanters_absorbtion_base_AuraScript::Trigger(), and npc_hallows_end_train_fire::UpdateAI().

◆ GetAuraEffectDummy()

AuraEffect * Unit::GetAuraEffectDummy ( uint32  spellid) const
5776{
5778 for (Unit::AuraEffectList::const_iterator itr = auras.begin(); itr != auras.end(); ++itr)
5779 {
5780 if ((*itr)->GetId() == spellid)
5781 return *itr;
5782 }
5783
5784 return nullptr;
5785}
@ SPELL_AURA_DUMMY
Definition SpellAuraDefines.h:67

References GetAuraEffectsByType(), and SPELL_AURA_DUMMY.

Referenced by Spell::EffectWeaponDmg(), Aura::HandleAuraSpecificMods(), spell_pilgrims_bounty_feast_on_generic::HandleDummy(), spell_dk_scourge_strike::HandleDummy(), Kill(), spell_dk_death_and_decay::RecalculateDamage(), and Player::RemoveSpellMods().

◆ GetAuraEffectOfRankedSpell()

AuraEffect * Unit::GetAuraEffectOfRankedSpell ( uint32  spellId,
uint8  effIndex,
ObjectGuid  casterGUID = ObjectGuid::Empty 
) const
5734{
5735 uint32 rankSpell = sSpellMgr->GetFirstSpellInChain(spellId);
5736 while (rankSpell)
5737 {
5738 if (AuraEffect* aurEff = GetAuraEffect(rankSpell, effIndex, caster))
5739 return aurEff;
5740 rankSpell = sSpellMgr->GetNextSpellInChain(rankSpell);
5741 }
5742 return nullptr;
5743}
AuraEffect * GetAuraEffect(uint32 spellId, uint8 effIndex, ObjectGuid casterGUID=ObjectGuid::Empty) const
Definition Unit.cpp:5719

References GetAuraEffect(), and sSpellMgr.

Referenced by spell_mage_fire_frost_ward::Absorb(), spell_sha_earthbind_totem::Apply(), spell_sha_earthliving_weapon::CheckProc(), GetDiseasesByCaster(), spell_dru_enrage::HandleApply(), spell_pal_avenging_wrath::HandleApply(), Aura::HandleAuraSpecificMods(), spell_dk_presence::HandleImprovedBloodPresence(), spell_dk_presence::HandleImprovedFrostPresence(), spell_dk_presence::HandleImprovedUnholyPresence(), spell_mage_imp_blizzard::HandleProc(), spell_warl_soul_leech::HandleProc(), SpellPctDamageModsDone(), and spell_mage_incanters_absorbtion_base_AuraScript::Trigger().

◆ GetAuraEffectsByType()

AuraEffectList const & Unit::GetAuraEffectsByType ( AuraType  type) const
inline
1417{ return m_modAuras[type]; }

References m_modAuras.

Referenced by Spell::_cast(), CalcAbsorbResist(), CalcArmorReducedDamage(), CalcHealAbsorb(), AuraEffect::CalculateAmount(), Spell::CanAutoCast(), Spell::CheckCast(), Spell::CheckCasterAuras(), DealDamage(), DealDamageShieldDamage(), Spell::EffectHeal(), Spell::EffectSchoolDMG(), RedirectSpellEvent::Execute(), spell_dk_wandering_plague::FilterTargets(), GetAuraEffect(), GetAuraEffect(), GetAuraEffectDummy(), GetDoTsByCaster(), GetHighestExclusiveSameEffectSpellGroupValue(), GetMagicHitRedirectTarget(), GetMaxNegativeAuraModifier(), GetMaxPositiveAuraModifier(), GetMeleeHitRedirectTarget(), GetPhaseByAuras(), Player::GetResurrectionSpellId(), Player::GetRuneBaseCooldown(), GetTotalAuraModifier(), GetTotalAuraMultiplier(), AuraEffect::HandleAuraDummy(), AuraEffect::HandleAuraModDisarm(), AuraEffect::HandleAuraModSchoolImmunity(), Aura::HandleAuraSpecificMods(), AuraEffect::HandleAuraTransform(), AuraEffect::HandleDetectAmore(), spell_pilgrims_bounty_feast_on_generic::HandleDummy(), spell_dru_nourish::HandleHeal(), Spell::HandleLaunchPhase(), WorldSession::HandleMessagechatOpcode(), WorldSession::HandleMirrorImageDataRequest(), AuraEffect::HandleModInvisibility(), modify_commandscript::HandleMorphMountCommand(), AuraEffect::HandleNoReagentUseAura(), spell_warr_heroic_strike::HandleOnHit(), spell_illidari_council_judgement::HandleScriptEffect(), spell_dk_glyph_of_scourge_strike_script::HandleScriptEffect(), spell_pal_judgement::HandleScriptEffect(), AuraEffect::HandleShapeshiftBoosts(), HasAuraState(), HasAuraTypeWithAffectMask(), HasAuraTypeWithCaster(), HasAuraTypeWithFamilyFlags(), HasAuraTypeWithMiscvalue(), HasAuraTypeWithTriggerSpell(), HasAuraTypeWithValue(), HasBreakableByDamageAuraType(), HasVisibleAuraType(), IsHighestExclusiveAuraEffect(), IsImmunedToSpellEffect(), IsScriptOverriden(), Player::isTotalImmune(), list_commandscript::ListAurasCommand(), MeleeDamageBonusTaken(), MeleeSpellHitResult(), Spell::PrepareTriggersExecutedOnHit(), processDummyAuras(), spell_dru_enrage::RecalculateBaseArmor(), Player::RegenerateAll(), Creature::Respawn(), RestoreDisplayId(), PetAI::SelectNextTarget(), Creature::SelectVictim(), Player::SendInitialPacketsAfterAddToMap(), SetControlled(), Player::SetEntryPoint(), Player::SetSkill(), SpellBaseDamageBonusDone(), SpellBaseHealingBonusDone(), SpellDamageBonusTaken(), SpellHealingBonusDone(), SpellHealingBonusTaken(), SpellPctDamageModsDone(), SpellPctHealingModsDone(), SpellTakenCritChance(), Player::SummonPet(), SimpleCharmedAI::UpdateAI(), npc_valkyr_shadowguard::npc_valkyr_shadowguardAI::UpdateAI(), Player::UpdateArmor(), Player::UpdateAttackPowerAndDamage(), Player::UpdateCharmedAI(), Player::UpdateManaRegen(), Player::UpdateRating(), Player::UpdateResistances(), UpdateSpeed(), and Player::UpdateStats().

◆ GetAuraOfRankedSpell()

Aura * Unit::GetAuraOfRankedSpell ( uint32  spellId,
ObjectGuid  casterGUID = ObjectGuid::Empty,
ObjectGuid  itemCasterGUID = ObjectGuid::Empty,
uint8  reqEffMask = 0 
) const
5825{
5826 AuraApplication* aurApp = GetAuraApplicationOfRankedSpell(spellId, casterGUID, itemCasterGUID, reqEffMask);
5827 return aurApp ? aurApp->GetBase() : nullptr;
5828}
AuraApplication * GetAuraApplicationOfRankedSpell(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint8 reqEffMask=0, AuraApplication *except=nullptr) const
Definition Unit.cpp:5812

References GetAuraApplicationOfRankedSpell(), and AuraApplication::GetBase().

Referenced by spell_sha_clearcasting::CalculateAmount(), Aura::HandleAuraSpecificMods(), spell_dk_pestilence::HandleScriptEffect(), and spell_mage_missile_barrage_proc::OnRemove().

◆ GetBoundaryRadius()

float Unit::GetBoundaryRadius ( ) const
inline

◆ GetCastingTimeForBonus()

uint32 Unit::GetCastingTimeForBonus ( SpellInfo const *  spellProto,
DamageEffectType  damagetype,
uint32  CastingTime 
) const
13593{
13594 // Not apply this to creature casted spells with casttime == 0
13595 if (CastingTime == 0 && IsCreature() && !IsPet())
13596 return 3500;
13597
13598 if (CastingTime > 7000) CastingTime = 7000;
13599 if (CastingTime < 1500) CastingTime = 1500;
13600
13601 if (damagetype == DOT && !spellProto->IsChanneled())
13602 CastingTime = 3500;
13603
13604 int32 overTime = 0;
13605 uint8 effects = 0;
13606 bool DirectDamage = false;
13607 bool AreaEffect = false;
13608
13609 for (uint32 i = 0; i < MAX_SPELL_EFFECTS; i++)
13610 {
13611 switch (spellProto->Effects[i].Effect)
13612 {
13618 case SPELL_EFFECT_HEAL:
13619 DirectDamage = true;
13620 break;
13622 switch (spellProto->Effects[i].ApplyAuraName)
13623 {
13627 if (spellProto->GetDuration())
13628 overTime = spellProto->GetDuration();
13629 break;
13630 default:
13631 // -5% per additional effect
13632 ++effects;
13633 break;
13634 }
13635 default:
13636 break;
13637 }
13638
13639 if (spellProto->Effects[i].IsTargetingArea())
13640 AreaEffect = true;
13641 }
13642
13643 // Combined Spells with Both Over Time and Direct Damage
13644 if (overTime > 0 && DirectDamage)
13645 {
13646 // mainly for DoTs which are 3500 here otherwise
13647 uint32 OriginalCastTime = spellProto->CalcCastTime();
13648 if (OriginalCastTime > 7000) OriginalCastTime = 7000;
13649 if (OriginalCastTime < 1500) OriginalCastTime = 1500;
13650 // Portion to Over Time
13651 float PtOT = (overTime / 15000.0f) / ((overTime / 15000.0f) + (OriginalCastTime / 3500.0f));
13652
13653 if (damagetype == DOT)
13654 CastingTime = uint32(CastingTime * PtOT);
13655 else if (PtOT < 1.0f)
13656 CastingTime = uint32(CastingTime * (1 - PtOT));
13657 else
13658 CastingTime = 0;
13659 }
13660
13661 // Area Effect Spells receive only half of bonus
13662 if (AreaEffect)
13663 CastingTime /= 2;
13664
13665 // 50% for damage and healing spells for leech spells from damage bonus and 0% from healing
13666 for (uint8 j = 0; j < MAX_SPELL_EFFECTS; ++j)
13667 {
13668 if (spellProto->Effects[j].Effect == SPELL_EFFECT_HEALTH_LEECH ||
13669 (spellProto->Effects[j].Effect == SPELL_EFFECT_APPLY_AURA && spellProto->Effects[j].ApplyAuraName == SPELL_AURA_PERIODIC_LEECH))
13670 {
13671 CastingTime /= 2;
13672 break;
13673 }
13674 }
13675
13676 // -5% of total per any additional effect
13677 for (uint8 i = 0; i < effects; ++i)
13678 CastingTime *= 0.95f;
13679
13680 return CastingTime;
13681}
@ SPELL_EFFECT_POWER_BURN
Definition SharedDefines.h:851
@ SPELL_EFFECT_HEALTH_LEECH
Definition SharedDefines.h:798
@ SPELL_EFFECT_HEAL
Definition SharedDefines.h:799
@ SPELL_EFFECT_ENVIRONMENTAL_DAMAGE
Definition SharedDefines.h:796
@ SPELL_EFFECT_POWER_DRAIN
Definition SharedDefines.h:797
@ SPELL_EFFECT_SCHOOL_DAMAGE
Definition SharedDefines.h:791
@ SPELL_EFFECT_APPLY_AURA
Definition SharedDefines.h:795
@ SPELL_AURA_PERIODIC_DAMAGE
Definition SpellAuraDefines.h:66
@ SPELL_AURA_PERIODIC_HEAL
Definition SpellAuraDefines.h:71
@ SPELL_AURA_PERIODIC_LEECH
Definition SpellAuraDefines.h:116

References SpellInfo::CalcCastTime(), DOT, SpellInfo::Effects, SpellInfo::GetDuration(), SpellInfo::IsChanneled(), Object::IsCreature(), IsPet(), MAX_SPELL_EFFECTS, SPELL_AURA_PERIODIC_DAMAGE, SPELL_AURA_PERIODIC_HEAL, SPELL_AURA_PERIODIC_LEECH, SPELL_EFFECT_APPLY_AURA, SPELL_EFFECT_ENVIRONMENTAL_DAMAGE, SPELL_EFFECT_HEAL, SPELL_EFFECT_HEALTH_LEECH, SPELL_EFFECT_POWER_BURN, SPELL_EFFECT_POWER_DRAIN, and SPELL_EFFECT_SCHOOL_DAMAGE.

Referenced by CalculateDefaultCoefficient().

◆ GetCharm()

Unit * Unit::GetCharm ( ) const
7661{
7662 if (ObjectGuid charm_guid = GetCharmGUID())
7663 {
7664 if (Unit* pet = ObjectAccessor::GetUnit(*this, charm_guid))
7665 return pet;
7666
7667 LOG_ERROR("entities.unit", "Unit::GetCharm: Charmed creature {} not exist.", charm_guid.ToString());
7669 }
7670
7671 return nullptr;
7672}
@ UNIT_FIELD_CHARM
Definition UpdateFields.h:86
void SetGuidValue(uint16 index, ObjectGuid value)
Definition Object.cpp:712
ObjectGuid GetCharmGUID() const
Definition Unit.h:715
Unit * GetUnit(WorldObject const &, ObjectGuid const &guid)
Definition ObjectAccessor.cpp:199

References ObjectGuid::Empty, GetCharmGUID(), ObjectAccessor::GetUnit(), LOG_ERROR, Object::SetGuidValue(), and UNIT_FIELD_CHARM.

Referenced by Spell::_cast(), AddPetAura(), spell_hun_check_pet_los::CheckCast(), Spell::CheckCast(), Dismount(), Spell::finish(), GetFirstControlled(), spell_warl_eye_of_kilrogg::HandleAuraApply(), spell_warl_eye_of_kilrogg::HandleAuraRemove(), spell_dk_raise_ally::HandleDummy(), WorldSession::HandlePetCastSpellOpcode(), WorldSession::HandlePetSpellAutocastOpcode(), WorldSession::HandleRequestPetInfo(), isPossessing(), Mount(), Player::PossessSpellInitialize(), RemovePetAura(), Spell::SelectImplicitCasterObjectTargets(), SetSpeed(), npc_pilgrims_bounty_chair::SpellHitTarget(), and Player::StopCastingCharm().

◆ GetCharmer()

◆ GetCharmerGUID()

◆ GetCharmerOrOwner()

◆ GetCharmerOrOwnerGUID()

◆ GetCharmerOrOwnerOrOwnGUID()

◆ GetCharmerOrOwnerOrSelf()

Unit * Unit::GetCharmerOrOwnerOrSelf ( ) const
inline
1277 {
1278 if (Unit* u = GetCharmerOrOwner())
1279 return u;
1280
1281 return (Unit*)this;
1282 }

References GetCharmerOrOwner().

Referenced by CombatStart(), CombatStartOnCast(), GetPartyMembers(), GetReactionTo(), IsInPartyWith(), IsInRaidWith(), SetInCombatWith(), and TotemAI::UpdateAI().

◆ GetCharmerOrOwnerPlayerOrPlayerItself()

Player * Unit::GetCharmerOrOwnerPlayerOrPlayerItself ( ) const
7606{
7608 if (guid.IsPlayer())
7609 return ObjectAccessor::GetPlayer(*this, guid);
7610
7611 return const_cast<Unit*>(this)->ToPlayer();
7612}
Player * GetPlayer(Map const *, ObjectGuid const &guid)
Definition ObjectAccessor.cpp:220

References GetCharmerOrOwnerGUID(), ObjectAccessor::GetPlayer(), ObjectGuid::IsPlayer(), and Object::ToPlayer().

Referenced by Spell::_handle_finish_phase(), _IsValidAttackTarget(), spell_sha_earthbind_totem::Apply(), npc_escortAI::AssistPlayerInCombatAgainst(), FollowerAI::AssistPlayerInCombatAgainst(), BuildValuesUpdate(), spell_q12237_rescue_villager::CheckCast(), spell_q12237_drop_off_villager::CheckCast(), CombatStart(), CombatStartOnCast(), boss_mal_ganis::boss_mal_ganisAI::DamageTaken(), DealDamage(), Spell::EffectGameObjectSetDestructionState(), Spell::EffectKillCredit(), Spell::EffectKillCreditPersonal(), Spell::EffectSummonPet(), GetAffectingPlayer(), Object::GetUpdateFieldData(), spell_gen_charmed_unit_spell_cooldown::HandleCast(), spell_q13007_iron_colossus::HandleDummy(), spell_pilgrims_bounty_pass_generic::HandleDummy(), spell_pilgrims_bounty_feast_on_generic::HandleDummy(), spell_q12851_going_bearback::HandleEffectApply(), spell_q12726_song_of_wind_and_water::HandleHealPct(), spell_winter_veil_racer_slam_hit::HandleScriptEffect(), spell_q10612_10613_the_fel_and_the_furious::HandleScriptEffect(), spell_q10769_dissension_amongst_the_ranks::HandleScriptEffect(), npc_pet_gen_valkyr_guardian::InitializeAI(), isTargetableForAttack(), GuardAI::JustDied(), boss_kurinnaxx::JustDied(), boss_lady_deathwhisper::boss_lady_deathwhisperAI::JustDied(), npc_darnavan::npc_darnavanAI::JustDied(), npc_four_car_garage::npc_four_car_garageAI::JustDied(), npc_scion_of_eternity::JustDied(), Kill(), Condition::Meets(), GameObject::ModifyHealth(), npc_amanishi_lookout::MoveInLineOfSight(), npc_eagle_trash_aggro_trigger::MoveInLineOfSight(), npc_mageguard_dalaran::npc_mageguard_dalaranAI::MoveInLineOfSight(), npc_fel_guard_hound::npc_fel_guard_houndAI::MovementInform(), SmartScript::ProcessAction(), ProcessTerrainStatusUpdate(), Pet::RemoveSpellCooldown(), Spell::SendSpellCooldown(), SetCharm(), SetContestedPvP(), SetInCombatState(), Creature::SetLootRecipient(), npc_deaths_door_fell_cannon_target_bunny::npc_deaths_door_fell_cannon_target_bunnyAI::SpellHit(), npc_scarlet_ghoul::npc_scarlet_ghoulAI::UpdateAI(), npc_fel_guard_hound::npc_fel_guard_houndAI::UpdateAI(), npc_pet_shaman_earth_elemental::UpdateAI(), npc_pet_shaman_fire_elemental::UpdateAI(), and Creature::UpdateEntry().

◆ GetCharmGUID()

◆ GetCharmInfo()

◆ getClass()

uint8 Unit::getClass ( ) const
inline
837{ return GetByteValue(UNIT_FIELD_BYTES_0, 1); }
@ UNIT_FIELD_BYTES_0
Definition UpdateFields.h:95
uint8 GetByteValue(uint16 index, uint8 offset) const
Definition Object.cpp:312

References Object::GetByteValue(), and UNIT_FIELD_BYTES_0.

Referenced by Player::_LoadHomeBind(), Player::_LoadSkills(), Player::_SaveCharacter(), ArenaTeam::AddMember(), SpellEffectInfo::CalcValue(), spell_dk_advantage_t10_4p::CheckProc(), spell_dk_death_rune::CheckProc(), Player::CheckSkillLearnedBySpell(), spell_class_call_handler::FilterTargets(), getClassMask(), GetDebugInfo(), Player::GetDodgeFromAgility(), SocialMgr::GetFriendInfo(), Player::GetMeleeCritFromAgility(), Player::GetMissPercentageFromDefence(), Player::GetPlayerName(), Player::GetRatingMultiplier(), Player::GetSpec(), Player::GetSpellCritFromIntellect(), Player::GetStartPosition(), Player::GiveLevel(), spell_item_flask_of_the_north::HandleDummy(), learn_commandscript::HandleLearnAllMySpellsCommand(), WorldSession::HandleMirrorImageDataRequest(), modify_commandscript::HandleModifyGenderCommand(), misc_commandscript::HandlePInfoCommand(), WorldSession::HandlePlayerLoginFromDB(), spell_item_soul_preserver::HandleProc(), spell_item_aura_of_madness::HandleProc(), spell_item_deathbringers_will_normal::HandleProc(), spell_item_deathbringers_will_heroic::HandleProc(), spell_item_sunwell_exalted_caster_neck::HandleProc(), spell_pal_t3_6p_bonus::HandleProc(), spell_sha_t3_6p_bonus::HandleProc(), ArenaSpectator::HandleResetCommand(), reset_commandscript::HandleResetStatsOrLevelHelper(), Player::InitDataForForm(), Player::InitDisplayIds(), Player::InitStatsForLevel(), Guardian::InitStatsForLevel(), Player::InitTaxiNodesForLevel(), Player::IsClass(), IsClass(), Player::IsSpellFitByClassAndRace(), Trainer::Trainer::IsTrainerValidForPlayer(), Player::LearnCustomSpells(), Player::LearnDefaultSkill(), Player::LearnDefaultSkills(), spell_dk_death_rune::Load(), Player::LoadFromDB(), AchievementCriteriaData::Meets(), Player::OCTRegenHPPerSpirit(), Player::OCTRegenMPPerSpirit(), ClassCallSelector::operator()(), Acore::WorldObjectSpellTargetCheck::operator()(), Player::RewardHonor(), WorldSession::SendNameQueryOpcode(), Guild::Member::SetStats(), npc_icc_valkyr_herald::npc_icc_valkyr_heraldAI::SpellHitTarget(), Player::StoreNewItemInBestSlots(), Player::UpdateDodgePercentage(), Player::UpdateParryPercentage(), lfg::LFGMgr::UpdateRaidBrowser(), and Player::UpdateSkillsForLevel().

◆ getClassMask()

◆ GetClientControlling()

Player const * Unit::GetClientControlling ( ) const
17586{
17587 // Serverside reverse "mover" deduction logic at controlled unit
17588
17589 // Applies only to player controlled units
17591 {
17592 // Charm always removes control from original client...
17593 if (GetCharmerGUID())
17594 {
17595 // ... but if it is a possessing charm, some other client may have control
17597 {
17598 Unit const* charmer = GetCharmer();
17599 if (charmer && charmer->IsPlayer())
17600 return static_cast<Player const*>(charmer);
17601 }
17602 }
17603 else if (IsPlayer())
17604 {
17605 // Check if anything prevents original client from controlling
17606 if (IsClientControlled(static_cast<Player const*>(this)))
17607 return static_cast<Player const*>(this);
17608 }
17609 }
17610 return nullptr;
17611}
bool IsClientControlled(Player const *exactClient=nullptr) const
Definition Unit.cpp:17558

References GetCharmer(), GetCharmerGUID(), Object::HasFlag(), IsClientControlled(), Object::IsPlayer(), UNIT_FIELD_FLAGS, UNIT_FLAG_PLAYER_CONTROLLED, and UNIT_FLAG_POSSESSED.

Referenced by SendMoveRoot(), SetCanFly(), SetDisableGravity(), SetFeatherFall(), SetHover(), SetSpeed(), and SetWaterWalking().

◆ GetCollisionHeight()

float Unit::GetCollisionHeight ( ) const
overridevirtual

Return collision height sent to client.

Reimplemented from WorldObject.

17318{
17319 float scaleMod = GetObjectScale(); // 99% sure about this
17320 float defaultHeight = DEFAULT_COLLISION_HEIGHT * scaleMod;
17321
17322 CreatureDisplayInfoEntry const* displayInfo = sCreatureDisplayInfoStore.AssertEntry(GetNativeDisplayId());
17323 CreatureModelDataEntry const* modelData = sCreatureModelDataStore.AssertEntry(displayInfo->ModelId);
17324 float collisionHeight = 0.0f;
17325
17326 if (IsMounted())
17327 {
17329 {
17330 if (CreatureModelDataEntry const* mountModelData = sCreatureModelDataStore.LookupEntry(mountDisplayInfo->ModelId))
17331 {
17332 collisionHeight = scaleMod * (mountModelData->MountHeight + modelData->CollisionHeight * modelData->Scale * displayInfo->scale * 0.5f);
17333 }
17334 }
17335 }
17336 else
17337 collisionHeight = scaleMod * modelData->CollisionHeight * modelData->Scale * displayInfo->scale;
17338
17339 return collisionHeight == 0.0f ? defaultHeight : collisionHeight;
17340}
DBCStorage< CreatureDisplayInfoEntry > sCreatureDisplayInfoStore(CreatureDisplayInfofmt)
DBCStorage< CreatureModelDataEntry > sCreatureModelDataStore(CreatureModelDatafmt)
#define DEFAULT_COLLISION_HEIGHT
Definition ObjectDefines.h:49
float GetObjectScale() const
Definition Object.h:119
Definition DBCStructure.h:721
uint32 ModelId
Definition DBCStructure.h:723
float scale
Definition DBCStructure.h:726
Definition DBCStructure.h:775
float Scale
Definition DBCStructure.h:779
float CollisionHeight
Definition DBCStructure.h:790

References CreatureModelDataEntry::CollisionHeight, DEFAULT_COLLISION_HEIGHT, GetNativeDisplayId(), Object::GetObjectScale(), Object::GetUInt32Value(), IsMounted(), CreatureDisplayInfoEntry::ModelId, CreatureDisplayInfoEntry::scale, CreatureModelDataEntry::Scale, sCreatureDisplayInfoStore, sCreatureModelDataStore, and UNIT_FIELD_MOUNTDISPLAYID.

Referenced by DynObjAura::FillTargetMap(), GetRandomContactPoint(), Acore::NearestAttackableNoTotemUnitInObjectRangeCheck::operator()(), WorldSession::ProcessMovementInfo(), ProcessTerrainStatusUpdate(), Spell::SelectImplicitCasterDestTargets(), spell_spawn_blood_pool::SetDest(), and Creature::UpdateMovementFlags().

◆ GetCollisionRadius()

float Unit::GetCollisionRadius ( ) const
overridevirtual

this method gets the radius of a Unit by DB if any value is defined, otherwise it gets the value by the DBC

If the player is mounted the radius also takes in consideration the mount size

Returns
float The radius of a unit

Reimplemented from WorldObject.

17312{
17313 return GetCollisionWidth() / 2;
17314}
float GetCollisionWidth() const override
this method gets the diameter of a Unit by DB if any value is defined, otherwise it gets the value by...
Definition Unit.cpp:17274

References GetCollisionWidth().

Referenced by GetMeleeAttackPoint(), and Creature::Update().

◆ GetCollisionWidth()

float Unit::GetCollisionWidth ( ) const
overridevirtual

this method gets the diameter of a Unit by DB if any value is defined, otherwise it gets the value by the DBC

If the player is mounted the diameter also takes in consideration the mount size

Returns
float The diameter of a unit

Dismounting case - use basic default model data

Reimplemented from WorldObject.

17275{
17276 if (IsPlayer())
17277 return GetObjectSize();
17278
17279 float scaleMod = GetObjectScale(); // 99% sure about this
17280 float objectSize = GetObjectSize();
17281 float defaultSize = DEFAULT_WORLD_OBJECT_SIZE * scaleMod;
17282
17284 CreatureDisplayInfoEntry const* displayInfo = sCreatureDisplayInfoStore.AssertEntry(GetNativeDisplayId());
17285 CreatureModelDataEntry const* modelData = sCreatureModelDataStore.AssertEntry(displayInfo->ModelId);
17286
17287 if (IsMounted())
17288 {
17290 {
17291 if (CreatureModelDataEntry const* mountModelData = sCreatureModelDataStore.LookupEntry(mountDisplayInfo->ModelId))
17292 {
17293 if (G3D::fuzzyGt(mountModelData->CollisionWidth, modelData->CollisionWidth))
17294 modelData = mountModelData;
17295 }
17296 }
17297 }
17298
17299 float collisionWidth = scaleMod * modelData->CollisionWidth * modelData->Scale * displayInfo->scale * 2;
17300 // if the objectSize is the default value or the creature is mounted and we have a DBC value, then we can retrieve DBC value instead
17301 return G3D::fuzzyGt(collisionWidth, 0.0f) && (G3D::fuzzyEq(objectSize,defaultSize) || IsMounted()) ? collisionWidth : objectSize;
17302}
#define DEFAULT_WORLD_OBJECT_SIZE
Definition ObjectDefines.h:44
float GetObjectSize() const
Definition Object.cpp:2808
float CollisionWidth
Definition DBCStructure.h:789

References CreatureModelDataEntry::CollisionWidth, DEFAULT_WORLD_OBJECT_SIZE, GetNativeDisplayId(), Object::GetObjectScale(), WorldObject::GetObjectSize(), Object::GetUInt32Value(), IsMounted(), Object::IsPlayer(), CreatureDisplayInfoEntry::ModelId, CreatureDisplayInfoEntry::scale, CreatureModelDataEntry::Scale, sCreatureDisplayInfoStore, sCreatureModelDataStore, and UNIT_FIELD_MOUNTDISPLAYID.

Referenced by GetCollisionRadius().

◆ GetCombatRatingDamageReduction()

uint32 Unit::GetCombatRatingDamageReduction ( CombatRating  cr,
float  rate,
float  cap,
uint32  damage 
) const
private
15559{
15560 float percent = std::min(GetCombatRatingReduction(cr) * rate, cap);
15561 return CalculatePct(damage, percent);
15562}
float GetCombatRatingReduction(CombatRating cr) const
Definition Unit.cpp:15546

References CalculatePct(), and GetCombatRatingReduction().

Referenced by GetMeleeCritDamageReduction(), GetMeleeDamageReduction(), GetRangedCritDamageReduction(), GetRangedDamageReduction(), GetSpellCritDamageReduction(), and GetSpellDamageReduction().

◆ GetCombatRatingReduction()

float Unit::GetCombatRatingReduction ( CombatRating  cr) const
private
15547{
15548 if (Player const* player = ToPlayer())
15549 return player->GetRatingBonusValue(cr);
15550 // Player's pet get resilience from owner
15551 else if (IsPet() && GetOwner())
15552 if (Player* owner = GetOwner()->ToPlayer())
15553 return owner->GetRatingBonusValue(cr);
15554
15555 return 0.0f;
15556}

References GetOwner(), IsPet(), and Object::ToPlayer().

Referenced by GetCombatRatingDamageReduction(), GetMeleeCritChanceReduction(), GetRangedCritChanceReduction(), and GetSpellCritChanceReduction().

◆ GetCombatReach()

◆ GetCombatTimer()

uint32 Unit::GetCombatTimer ( ) const
inline
938{ return m_CombatTimer; }

References m_CombatTimer.

Referenced by Spell::DoSpellHitOnUnit(), and SetInCombatState().

◆ GetComboPoints() [1/2]

uint8 Unit::GetComboPoints ( ObjectGuid const &  guid) const
inline
1004{ return (m_comboTarget && m_comboTarget->GetGUID() == guid) ? m_comboPoints : 0; }

References Object::GetGUID(), m_comboPoints, and m_comboTarget.

◆ GetComboPoints() [2/2]

uint8 Unit::GetComboPoints ( Unit const *  who = nullptr) const
inline

◆ GetComboTarget()

Unit * Unit::GetComboTarget ( ) const
inline
1005{ return m_comboTarget; }

References m_comboTarget.

Referenced by Player::DuelComplete().

◆ GetComboTargetGUID()

ObjectGuid const Unit::GetComboTargetGUID ( ) const
inline

◆ GetCompanionPet()

Creature * Unit::GetCompanionPet ( ) const
7656{
7658}
@ SUMMON_SLOT_MINIPET
Definition SharedDefines.h:3556
Creature * GetCreature(WorldObject const &u, ObjectGuid const &guid)
Definition ObjectAccessor.cpp:210

References ObjectAccessor::GetCreature(), m_SummonSlot, and SUMMON_SLOT_MINIPET.

◆ GetCreateHealth()

◆ GetCreateMana()

◆ GetCreatePowers()

uint32 Unit::GetCreatePowers ( Powers  power) const
12657{
12658 // Only hunter pets have POWER_FOCUS and POWER_HAPPINESS
12659 switch (power)
12660 {
12661 case POWER_MANA:
12662 return GetCreateMana();
12663 case POWER_RAGE:
12664 return 1000;
12665 case POWER_FOCUS:
12666 return (IsPlayer() || !((Creature const*)this)->IsPet() || ((Pet const*)this)->getPetType() != HUNTER_PET ? 0 : 100);
12667 case POWER_ENERGY:
12668 return 100;
12669 case POWER_HAPPINESS:
12670 return (IsPlayer() || !((Creature const*)this)->IsPet() || ((Pet const*)this)->getPetType() != HUNTER_PET ? 0 : 1050000);
12671 case POWER_RUNIC_POWER:
12672 return 1000;
12673 case POWER_RUNE:
12674 return 0;
12675 case POWER_HEALTH:
12676 return 0;
12677 default:
12678 break;
12679 }
12680
12681 return 0;
12682}
@ POWER_HEALTH
Definition SharedDefines.h:289
@ POWER_RUNIC_POWER
Definition SharedDefines.h:286
@ POWER_ENERGY
Definition SharedDefines.h:283
@ POWER_RUNE
Definition SharedDefines.h:285
@ POWER_FOCUS
Definition SharedDefines.h:282
uint32 GetCreateMana() const
Definition Unit.h:1137

References GetCreateMana(), HUNTER_PET, IsPet(), Object::IsPlayer(), POWER_ENERGY, POWER_FOCUS, POWER_HAPPINESS, POWER_HEALTH, POWER_MANA, POWER_RAGE, POWER_RUNE, and POWER_RUNIC_POWER.

Referenced by Pet::CreateBaseAtTamed(), spell_dru_glyph_of_innervate::HandleProc(), Player::InitStatsForLevel(), Pet::LoadPetFromDB(), setPowerType(), Guardian::UpdateMaxPower(), and Player::UpdateMaxPower().

◆ GetCreateStat()

float Unit::GetCreateStat ( Stats  stat) const
inline

◆ GetCreatorGUID()

ObjectGuid Unit::GetCreatorGUID ( ) const
inline
@ UNIT_FIELD_CREATEDBY
Definition UpdateFields.h:91

References Object::GetGuidValue(), and UNIT_FIELD_CREATEDBY.

Referenced by Condition::Meets().

◆ GetCreatureType()

uint32 Unit::GetCreatureType ( ) const
12068{
12069 if (IsPlayer())
12070 {
12072 SpellShapeshiftFormEntry const* ssEntry = sSpellShapeshiftFormStore.LookupEntry(form);
12073 if (ssEntry && ssEntry->creatureType > 0)
12074 return ssEntry->creatureType;
12075 else
12077 }
12078 else
12079 return ToCreature()->GetCreatureTemplate()->type;
12080}
DBCStorage< SpellShapeshiftFormEntry > sSpellShapeshiftFormStore(SpellShapeshiftFormEntryfmt)
@ CREATURE_TYPE_HUMANOID
Definition SharedDefines.h:2635
ShapeshiftForm
Definition UnitDefines.h:68
ShapeshiftForm GetShapeshiftForm() const
Definition Unit.h:1940
uint32 type
Definition CreatureData.h:218
Definition DBCStructure.h:1817
int32 creatureType
Definition DBCStructure.h:1823

References CREATURE_TYPE_HUMANOID, SpellShapeshiftFormEntry::creatureType, Creature::GetCreatureTemplate(), GetShapeshiftForm(), Object::IsPlayer(), sSpellShapeshiftFormStore, Object::ToCreature(), and CreatureTemplate::type.

Referenced by Creature::CanStartAttack(), spell_utgarde_pinnacle_beast_mark::CheckProc(), Spell::EffectKnockBack(), GetCreatureTypeMask(), GetUnitParryChance(), AuraEffect::HandleAuraEmpathy(), spell_dru_starfall_dummy::HandleDummy(), IsCritter(), CreatureAI::MoveInLineOfSight(), npc_mageguard_dalaran::npc_mageguard_dalaranAI::MoveInLineOfSight(), instance_sunken_temple::instance_sunken_temple_InstanceMapScript::OnCreatureCreate(), instance_sunken_temple::instance_sunken_temple_InstanceMapScript::OnUnitDeath(), Acore::AnyUnfriendlyNoTotemUnitInObjectRangeCheck::operator()(), Acore::NearestAttackableNoTotemUnitInObjectRangeCheck::operator()(), SetInCombatState(), and Creature::UpdateMoveInLineOfSightState().

◆ GetCreatureTypeMask()

uint32 Unit::GetCreatureTypeMask ( ) const
inline
823 {
824 uint32 creatureType = GetCreatureType();
825 return (creatureType >= 1) ? (1 << (creatureType - 1)) : 0;
826 }
uint32 GetCreatureType() const
Definition Unit.cpp:12067

References GetCreatureType().

Referenced by CalculateMeleeDamage(), CalculateSpellDamageTaken(), SpellInfo::CheckTargetCreatureType(), MeleeDamageBonusDone(), SpellCriticalDamageBonus(), SpellCriticalHealingBonus(), SpellDamageBonusDone(), SpellPctDamageModsDone(), and SpellTakenCritChance().

◆ GetCritterGUID()

ObjectGuid Unit::GetCritterGUID ( ) const
inline

◆ GetCurrentSpell() [1/2]

◆ GetCurrentSpell() [2/2]

Spell * Unit::GetCurrentSpell ( uint32  spellType) const
inline
1566{ return m_currentSpells[spellType]; }

References m_currentSpells.

◆ GetCurrentSpellCastTime()

int32 Unit::GetCurrentSpellCastTime ( uint32  spell_id) const
4305{
4306 if (Spell const* spell = FindCurrentSpellBySpellId(spell_id))
4307 return spell->GetCastTime();
4308 return 0;
4309}
Spell * FindCurrentSpellBySpellId(uint32 spell_id) const
Definition Unit.cpp:4296

References FindCurrentSpellBySpellId(), and Spell::GetCastTime().

Referenced by CasterAI::JustEngagedWith(), CasterAI::UpdateAI(), and boss_mandokir::boss_mandokirAI::UpdateAI().

◆ getDeathState()

◆ GetDebugInfo()

std::string Unit::GetDebugInfo ( ) const
overridevirtual

Reimplemented from Object.

17548{
17549 std::stringstream sstr;
17550 sstr << WorldObject::GetDebugInfo() << "\n"
17551 << std::boolalpha
17552 << "AliveState: " << IsAlive()
17553 << " UnitMovementFlags: " << GetUnitMovementFlags() << " ExtraUnitMovementFlags: " << GetExtraUnitMovementFlags()
17554 << " Class: " << std::to_string(getClass());
17555 return sstr.str();
17556}
std::string GetDebugInfo() const override
Definition Object.cpp:2507

References getClass(), WorldObject::GetDebugInfo(), GetExtraUnitMovementFlags(), GetUnitMovementFlags(), and IsAlive().

Referenced by UnitAI::GetDebugInfo(), Creature::GetDebugInfo(), and Player::GetDebugInfo().

◆ GetDefaultMovementType()

MovementGeneratorType Unit::GetDefaultMovementType ( ) const
virtual

-------—End of Pet responses methods-------—

Reimplemented in Creature.

13132{
13133 return IDLE_MOTION_TYPE;
13134}
@ IDLE_MOTION_TYPE
Definition MotionMaster.h:39

References IDLE_MOTION_TYPE.

◆ GetDefenseSkillValue()

uint32 Unit::GetDefenseSkillValue ( Unit const *  target = nullptr) const
3747{
3748 if (IsPlayer())
3749 {
3750 // in PvP use full skill instead current skill value
3751 uint32 value = (target && target->IsPlayer())
3754 value += uint32(ToPlayer()->GetRatingBonusValue(CR_DEFENSE_SKILL));
3755 return value;
3756 }
3757 else
3758 return GetUnitMeleeSkill(target);
3759}
@ SKILL_DEFENSE
Definition SharedDefines.h:3121
@ CR_DEFENSE_SKILL
Definition Unit.h:225
uint16 GetSkillValue(uint32 skill) const
Definition Player.cpp:5443
uint16 GetMaxSkillValue(uint32 skill) const
Definition Player.cpp:5460

References CR_DEFENSE_SKILL, Player::GetMaxSkillValue(), Player::GetSkillValue(), GetUnitMeleeSkill(), Object::IsPlayer(), SKILL_DEFENSE, and Object::ToPlayer().

Referenced by spell_pal_ardent_defender::Absorb(), DealMeleeDamage(), GetUnitCriticalChance(), RollMeleeOutcomeAgainst(), SpellTakenCritChance(), Player::UpdateBlockPercentage(), and lfg::LFGMgr::UpdateRaidBrowser().

◆ GetDiminishing()

DiminishingLevels Unit::GetDiminishing ( DiminishingGroup  group)
11888{
11889 for (Diminishing::iterator i = m_Diminishing.begin(); i != m_Diminishing.end(); ++i)
11890 {
11891 if (i->DRGroup != group)
11892 continue;
11893
11894 if (!i->hitCount)
11895 return DIMINISHING_LEVEL_1;
11896
11897 if (!i->hitTime)
11898 return DIMINISHING_LEVEL_1;
11899
11900 // If last spell was casted more than 15 seconds ago - reset the count.
11901 if (i->stack == 0 && getMSTimeDiff(i->hitTime, GameTime::GetGameTimeMS().count()) > 15000)
11902 {
11903 i->hitCount = DIMINISHING_LEVEL_1;
11904 return DIMINISHING_LEVEL_1;
11905 }
11906 // or else increase the count.
11907 else
11908 return DiminishingLevels(i->hitCount);
11909 }
11910 return DIMINISHING_LEVEL_1;
11911}
uint32 getMSTimeDiff(uint32 oldMSTime, uint32 newMSTime)
Definition Timer.h:110

References DIMINISHING_LEVEL_1, GameTime::GetGameTimeMS(), getMSTimeDiff(), and m_Diminishing.

Referenced by Spell::DoSpellHitOnUnit().

◆ GetDirectTransport()

TransportBase * Unit::GetDirectTransport ( ) const

◆ GetDiseasesByCaster()

uint32 Unit::GetDiseasesByCaster ( ObjectGuid  casterGUID,
uint8  mode = 0 
)
6070{
6071 static const AuraType diseaseAuraTypes[] =
6072 {
6073 SPELL_AURA_PERIODIC_DAMAGE, // Frost Fever and Blood Plague
6074 SPELL_AURA_LINKED, // Crypt Fever and Ebon Plague
6076 };
6077
6078 ObjectGuid drwGUID;
6079
6080 if (Player* playerCaster = ObjectAccessor::GetPlayer(*this, casterGUID))
6081 drwGUID = playerCaster->getRuneWeaponGUID();
6082
6083 uint32 diseases = 0;
6084 for (uint8 index = 0; diseaseAuraTypes[index] != SPELL_AURA_NONE; ++index)
6085 {
6086 for (AuraEffectList::iterator i = m_modAuras[diseaseAuraTypes[index]].begin(); i != m_modAuras[diseaseAuraTypes[index]].end();)
6087 {
6088 // Get auras with disease dispel type by caster
6089 if ((*i)->GetSpellInfo()->Dispel == DISPEL_DISEASE
6090 && ((*i)->GetCasterGUID() == casterGUID || (*i)->GetCasterGUID() == drwGUID)) // if its caster or his dancing rune weapon
6091 {
6092 ++diseases;
6093
6094 if (mode == 1)
6095 {
6096 RemoveAura((*i)->GetId(), (*i)->GetCasterGUID());
6097 i = m_modAuras[diseaseAuraTypes[index]].begin();
6098 continue;
6099 }
6100 // used for glyph of scourge strike
6101 else if (mode == 2)
6102 {
6103 Aura* aura = (*i)->GetBase();
6104 uint32 countMin = aura->GetMaxDuration();
6105 uint32 countMax = aura->GetSpellInfo()->GetMaxDuration() + 9000;
6106
6107 if (AuraEffect const* epidemic = (*i)->GetCaster()->GetAuraEffectOfRankedSpell(49036, EFFECT_0))
6108 countMax += epidemic->GetAmount();
6109
6110 if (countMin < countMax)
6111 {
6112 aura->SetDuration(uint32(aura->GetDuration() + 3000));
6113 aura->SetMaxDuration(countMin + 3000);
6114 }
6115 }
6116 }
6117 ++i;
6118 }
6119 }
6120 return diseases;
6121}
@ EFFECT_0
Definition SharedDefines.h:31
@ DISPEL_DISEASE
Definition SharedDefines.h:1386
AuraType
Definition SpellAuraDefines.h:62
@ SPELL_AURA_LINKED
Definition SpellAuraDefines.h:347
@ SPELL_AURA_NONE
Definition SpellAuraDefines.h:63
int32 GetMaxDuration() const
Definition SpellAuras.h:129
void SetMaxDuration(int32 duration)
Definition SpellAuras.h:130
int32 GetMaxDuration() const
Definition SpellInfo.cpp:2238
AuraEffect * GetAuraEffectOfRankedSpell(uint32 spellId, uint8 effIndex, ObjectGuid casterGUID=ObjectGuid::Empty) const
Definition Unit.cpp:5733

References DISPEL_DISEASE, EFFECT_0, GetAuraEffectOfRankedSpell(), AuraEffect::GetCaster(), Aura::GetDuration(), Aura::GetMaxDuration(), SpellInfo::GetMaxDuration(), ObjectAccessor::GetPlayer(), Aura::GetSpellInfo(), m_modAuras, RemoveAura(), Aura::SetDuration(), Aura::SetMaxDuration(), SPELL_AURA_LINKED, SPELL_AURA_NONE, and SPELL_AURA_PERIODIC_DAMAGE.

Referenced by Spell::EffectWeaponDmg(), and SpellPctDamageModsDone().

◆ GetDispellableAuraList()

void Unit::GetDispellableAuraList ( Unit caster,
uint32  dispelMask,
DispelChargesList dispelList,
SpellInfo const *  dispelSpell 
)
5831{
5832 // we should not be able to dispel diseases if the target is affected by unholy blight
5833 if (dispelMask & (1 << DISPEL_DISEASE) && HasAura(50536))
5834 dispelMask &= ~(1 << DISPEL_DISEASE);
5835
5836 ReputationRank rank = GetReactionTo(caster, IsCharmed());
5837 bool positive = rank >= REP_FRIENDLY;
5838
5839 // Neutral unit not at war with caster should be treated as a friendly unit
5840 if (rank == REP_NEUTRAL)
5841 {
5842 if (Player* casterPlayer = caster->GetAffectingPlayer())
5843 {
5844 if (FactionTemplateEntry const* factionTemplateEntry = GetFactionTemplateEntry())
5845 {
5846 if (FactionEntry const* factionEntry = sFactionStore.LookupEntry(factionTemplateEntry->faction))
5847 {
5848 if (factionEntry->CanBeSetAtWar())
5849 {
5850 positive = !casterPlayer->GetReputationMgr().IsAtWar(factionEntry);
5851 }
5852 }
5853 }
5854 }
5855 }
5856
5857 Unit::VisibleAuraMap const* visibleAuras = GetVisibleAuras();
5858 for (Unit::VisibleAuraMap::const_iterator itr = visibleAuras->begin(); itr != visibleAuras->end(); ++itr)
5859 {
5860 Aura* aura = itr->second->GetBase();
5861
5862 // don't try to remove passive auras
5863 if (aura->IsPassive())
5864 continue;
5865
5866 if (aura->GetSpellInfo()->GetDispelMask() & dispelMask)
5867 {
5868 if (aura->GetSpellInfo()->Dispel == DISPEL_MAGIC)
5869 {
5870 // do not remove positive auras if friendly target
5871 // negative auras if non-friendly target
5872 if (itr->second->IsPositive() == positive)
5873 continue;
5874 }
5875
5876 // Banish should only be dispelled by Mass Dispel
5877 if (aura->GetSpellInfo()->Mechanic == MECHANIC_BANISH && !dispelSpell->HasAttribute(SPELL_ATTR0_NO_IMMUNITIES))
5878 {
5879 continue;
5880 }
5881
5882 // The charges / stack amounts don't count towards the total number of auras that can be dispelled.
5883 // Ie: A dispel on a target with 5 stacks of Winters Chill and a Polymorph has 1 / (1 + 1) -> 50% chance to dispell
5884 // Polymorph instead of 1 / (5 + 1) -> 16%.
5885 bool dispel_charges = aura->GetSpellInfo()->HasAttribute(SPELL_ATTR7_DISPEL_REMOVES_CHARGES);
5886 uint8 charges = dispel_charges ? aura->GetCharges() : aura->GetStackAmount();
5887 if (charges > 0)
5888 dispelList.push_back(std::make_pair(aura, charges));
5889 }
5890 }
5891}
@ SPELL_ATTR7_DISPEL_REMOVES_CHARGES
Definition SharedDefines.h:662
@ MECHANIC_BANISH
Definition SharedDefines.h:1354
@ SPELL_ATTR0_NO_IMMUNITIES
Definition SharedDefines.h:422
@ REP_FRIENDLY
Definition SharedDefines.h:184
@ DISPEL_MAGIC
Definition SharedDefines.h:1384
uint8 GetStackAmount() const
Definition SpellAuras.h:148
uint8 GetCharges() const
Definition SpellAuras.h:141
bool IsPassive() const
Definition SpellAuras.cpp:1028
uint32 Mechanic
Definition SpellInfo.h:323
uint32 Dispel
Definition SpellInfo.h:322
bool HasAura(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint8 reqEffMask=0) const
Definition Unit.cpp:5946
std::map< uint8, AuraApplication * > VisibleAuraMap
Definition Unit.h:681
VisibleAuraMap const * GetVisibleAuras()
Definition Unit.h:1528

References SpellInfo::Dispel, DISPEL_DISEASE, DISPEL_MAGIC, GetAffectingPlayer(), Aura::GetCharges(), SpellInfo::GetDispelMask(), GetFactionTemplateEntry(), GetReactionTo(), Aura::GetSpellInfo(), Aura::GetStackAmount(), GetVisibleAuras(), SpellInfo::HasAttribute(), HasAura(), IsCharmed(), Aura::IsPassive(), SpellInfo::Mechanic, MECHANIC_BANISH, REP_FRIENDLY, REP_NEUTRAL, sFactionStore, SPELL_ATTR0_NO_IMMUNITIES, and SPELL_ATTR7_DISPEL_REMOVES_CHARGES.

Referenced by Spell::CheckCast(), and Spell::EffectDispel().

◆ GetDisplayId()

◆ GetDisplayRace()

DisplayRace Unit::GetDisplayRace ( ) const
inline
DisplayRace GetDisplayRaceFromModelId(uint32 modelId) const
Definition Unit.cpp:17236
uint32 GetDisplayId() const
Definition Unit.h:1957

References GetDisplayId(), and GetDisplayRaceFromModelId().

Referenced by AuraEffect::HandleAuraTransform().

◆ GetDisplayRaceFromModelId()

DisplayRace Unit::GetDisplayRaceFromModelId ( uint32  modelId) const
17237{
17238 if (CreatureDisplayInfoEntry const* display = sCreatureDisplayInfoStore.LookupEntry(modelId))
17239 {
17240 if (CreatureDisplayInfoExtraEntry const* displayExtra = sCreatureDisplayInfoExtraStore.LookupEntry(display->ExtendedDisplayInfoID))
17241 {
17242 return DisplayRace(displayExtra->DisplayRaceID);
17243 }
17244 }
17245 return DisplayRace::None;
17246}
DBCStorage< CreatureDisplayInfoExtraEntry > sCreatureDisplayInfoExtraStore(CreatureDisplayInfoExtrafmt)
DisplayRace
Definition SharedDefines.h:111
Definition DBCStructure.h:739

References None, sCreatureDisplayInfoExtraStore, and sCreatureDisplayInfoStore.

Referenced by GetDisplayRace().

◆ GetDoTsByCaster()

uint32 Unit::GetDoTsByCaster ( ObjectGuid  casterGUID) const
6124{
6125 static const AuraType diseaseAuraTypes[] =
6126 {
6130 };
6131
6132 uint32 dots = 0;
6133 for (AuraType const* itr = &diseaseAuraTypes[0]; itr && itr[0] != SPELL_AURA_NONE; ++itr)
6134 {
6135 Unit::AuraEffectList const& auras = GetAuraEffectsByType(*itr);
6136 for (AuraEffectList::const_iterator i = auras.begin(); i != auras.end(); ++i)
6137 {
6138 // Get auras by caster
6139 if ((*i)->GetCasterGUID() == casterGUID)
6140 ++dots;
6141 }
6142 }
6143 return dots;
6144}
@ SPELL_AURA_PERIODIC_DAMAGE_PERCENT
Definition SpellAuraDefines.h:152

References GetAuraEffectsByType(), SPELL_AURA_NONE, SPELL_AURA_PERIODIC_DAMAGE, and SPELL_AURA_PERIODIC_DAMAGE_PERCENT.

Referenced by SpellPctDamageModsDone().

◆ GetDummyAuraEffect()

◆ GetDynamicFlags()

◆ GetDynObject()

DynamicObject * Unit::GetDynObject ( uint32  spellId)
6462{
6463 if (m_dynObj.empty())
6464 return nullptr;
6465 for (DynObjectList::const_iterator i = m_dynObj.begin(); i != m_dynObj.end(); ++i)
6466 {
6467 DynamicObject* dynObj = *i;
6468 if (dynObj->GetSpellId() == spellId)
6469 return dynObj;
6470 }
6471 return nullptr;
6472}
Definition DynamicObject.h:35
uint32 GetSpellId() const
Definition DynamicObject.h:58

References DynamicObject::GetSpellId(), and m_dynObj.

Referenced by Spell::DelayedChannel(), WorldSession::HandleFarSightOpcode(), and boss_akilzon::JustEngagedWith().

◆ GetEffectiveResistChance()

float Unit::GetEffectiveResistChance ( Unit const *  owner,
SpellSchoolMask  schoolMask,
Unit const *  victim 
)
static
2238{
2239 float victimResistance = static_cast<float>(victim->GetResistance(schoolMask));
2240 if (owner)
2241 {
2242 // Xinef: pets inherit 100% of masters penetration
2243 // Xinef: excluding traps
2244 Player const* player = owner->GetSpellModOwner();
2245 if (player && owner->GetEntry() != WORLD_TRIGGER)
2246 {
2247 victimResistance += static_cast<float>(player->GetTotalAuraModifierByMiscMask(SPELL_AURA_MOD_TARGET_RESISTANCE, schoolMask));
2248 victimResistance -= static_cast<float>(player->GetSpellPenetrationItemMod());
2249 }
2250 else
2251 victimResistance += static_cast<float>(owner->GetTotalAuraModifierByMiscMask(SPELL_AURA_MOD_TARGET_RESISTANCE, schoolMask));
2252 }
2253
2254 victimResistance = std::max(victimResistance, 0.0f);
2255 if (owner)
2256 victimResistance += std::max(static_cast<float>(victim->GetLevel() - owner->GetLevel()) * 5.0f, 0.0f);
2257
2258 float level = static_cast<float>(victim->GetLevel());
2259 float resistanceConstant = 0.0f;
2260
2261 if (level > 60.0f)
2262 resistanceConstant = 150.0f + (level - 60.0f) * (level - 67.5f);
2263 else if (level > 20.0f)
2264 resistanceConstant = 50.0f + (level - 20.0f) * 2.5f;
2265 else
2266 resistanceConstant = 50.0f;
2267
2268 return std::min(victimResistance / (victimResistance + resistanceConstant), 0.75f);
2269}
int32 GetSpellPenetrationItemMod() const
Definition Player.h:1990

References Object::GetEntry(), GetLevel(), GetResistance(), GetSpellModOwner(), Player::GetSpellPenetrationItemMod(), GetTotalAuraModifierByMiscMask(), SPELL_AURA_MOD_TARGET_RESISTANCE, and WORLD_TRIGGER.

Referenced by CalcAbsorbResist(), and MagicSpellHitResult().

◆ GetExtraUnitMovementFlags()

uint16 Unit::GetExtraUnitMovementFlags ( ) const
inline

◆ GetFaction()

uint32 Unit::GetFaction ( ) const
inline

References Object::GetUInt32Value(), and UNIT_FIELD_FACTIONTEMPLATE.

Referenced by npc_av_marshal_or_warmaster::npc_av_marshal_or_warmasterAI::AttackStart(), npc_ulduar_arachnopod_destroyer::AttackStart(), Creature::CanAssistTo(), spell_q10985_light_of_the_naaru::CheckProc(), boss_eadric::boss_eadricAI::DamageTaken(), boss_paletress::boss_paletressAI::DamageTaken(), Spell::EffectDuel(), Spell::EffectSummonType(), npc_av_marshal_or_warmaster::npc_av_marshal_or_warmasterAI::EnterEvadeMode(), npc_ulduar_arachnopod_destroyer::EnterEvadeMode(), npc_chesspiece::GetDefaultOrientationForTeam(), GetFactionTemplateEntry(), GetReactionTo(), WorldSession::HandleAuctionListBidderItems(), WorldSession::HandleAuctionListItems(), WorldSession::HandleAuctionListOwnerItems(), WorldSession::HandleAuctionPlaceBid(), WorldSession::HandleAuctionRemoveItem(), WorldSession::HandleAuctionSellItem(), WorldSession::HandleGossipHelloOpcode(), modify_commandscript::HandleModifyFactionCommand(), npc_commandscript::HandleNpcGuidCommand(), npc_commandscript::HandleNpcInfoCommand(), npc_echo_of_medivh::HandlePieceJustDied(), WorldSession::HandlePlayerLoginFromDB(), TempSummon::InitStats(), InitTamedPet(), IsFriendly(), IsInPartyWith(), IsInRaidWith(), npc_infra_green_bomber_generic::npc_infra_green_bomber_genericAI::IsSummonedBy(), npc_isle_of_conquest_turret::npc_isle_of_conquest_turretAI::JustDied(), boss_shade_of_aran::JustEngagedWith(), npc_escortAI::JustRespawned(), FollowerAI::JustRespawned(), SmartAI::JustRespawned(), boss_volkhan::JustSummoned(), Pet::LoadPetFromDB(), npc_chesspiece::npc_chesspiece(), npc_plucky::npc_pluckyAI::npc_pluckyAI(), npc_taskmaster_fizzule::npc_taskmaster_fizzuleAI::npc_taskmaster_fizzuleAI(), npc_eris_hevenfire::OnQuestAccept(), npc_cork_gizelton::OnQuestAccept(), npc_ulduar_arachnopod_destroyer::PassengerBoarded(), npc_frosthound::PassengerBoarded(), PatchValuesUpdate(), npc_taskmaster_fizzule::npc_taskmaster_fizzuleAI::ReceiveEmote(), npc_plucky::npc_pluckyAI::Reset(), npc_swarm_scarab::npc_swarm_scarabAI::Reset(), npc_future_you::npc_future_youAI::Reset(), WorldSession::SendAuctionHello(), SetCharmedBy(), Player::SetGameMaster(), npc_chesspiece::sGossipHello(), boss_malchezaar::SpawnInfernal(), Spell::SummonGuardian(), Player::SummonPet(), npc_chesspiece::UpdateAI(), npc_rabid_thistle_bear::npc_rabid_thistle_bearAI::UpdateAI(), boss_malygos::UpdateAI(), npc_ulduar_arachnopod_destroyer::UpdateAI(), npc_overlord_drakuru_betrayal::UpdateAI(), and Creature::UpdateMoveInLineOfSightState().

◆ GetFactionReactionTo()

ReputationRank Unit::GetFactionReactionTo ( FactionTemplateEntry const *  factionTemplateEntry,
Unit const *  target 
) const
7149{
7150 // always neutral when no template entry found
7151 if (!factionTemplateEntry)
7152 return REP_NEUTRAL;
7153
7154 FactionTemplateEntry const* targetFactionTemplateEntry = target->GetFactionTemplateEntry();
7155 if (!targetFactionTemplateEntry)
7156 return REP_NEUTRAL;
7157
7158 // xinef: check forced reputation for self also
7159 if (Player const* selfPlayerOwner = GetAffectingPlayer())
7160 if (ReputationRank const* repRank = selfPlayerOwner->GetReputationMgr().GetForcedRankIfAny(target->GetFactionTemplateEntry()))
7161 return *repRank;
7162
7163 if (Player const* targetPlayerOwner = target->GetAffectingPlayer())
7164 {
7165 // check contested flags
7166 if (factionTemplateEntry->factionFlags & FACTION_TEMPLATE_FLAG_ATTACK_PVP_ACTIVE_PLAYERS
7167 && targetPlayerOwner->HasPlayerFlag(PLAYER_FLAGS_CONTESTED_PVP))
7168 return REP_HOSTILE;
7169 if (ReputationRank const* repRank = targetPlayerOwner->GetReputationMgr().GetForcedRankIfAny(factionTemplateEntry))
7170 return *repRank;
7171 if (!target->HasUnitFlag2(UNIT_FLAG2_IGNORE_REPUTATION))
7172 {
7173 if (FactionEntry const* factionEntry = sFactionStore.LookupEntry(factionTemplateEntry->faction))
7174 {
7175 if (factionEntry->CanHaveReputation())
7176 {
7177 // CvP case - check reputation, don't allow state higher than neutral when at war
7178 ReputationRank repRank = targetPlayerOwner->GetReputationMgr().GetRank(factionEntry);
7179 if (targetPlayerOwner->GetReputationMgr().IsAtWar(factionEntry))
7180 repRank = std::min(REP_NEUTRAL, repRank);
7181 return repRank;
7182 }
7183 }
7184 }
7185 }
7186
7187 // common faction based check
7188 if (factionTemplateEntry->IsHostileTo(*targetFactionTemplateEntry))
7189 return REP_HOSTILE;
7190 if (factionTemplateEntry->IsFriendlyTo(*targetFactionTemplateEntry))
7191 return REP_FRIENDLY;
7192 if (targetFactionTemplateEntry->IsFriendlyTo(*factionTemplateEntry))
7193 return REP_FRIENDLY;
7194 if (factionTemplateEntry->factionFlags & FACTION_TEMPLATE_FLAG_HATES_ALL_EXCEPT_FRIENDS)
7195 return REP_HOSTILE;
7196 // neutral by default
7197 return REP_NEUTRAL;
7198}
@ FACTION_TEMPLATE_FLAG_HATES_ALL_EXCEPT_FRIENDS
Definition DBCEnums.h:332
@ UNIT_FLAG2_IGNORE_REPUTATION
Definition UnitDefines.h:295
bool IsFriendlyTo(FactionTemplateEntry const &entry) const
Definition DBCStructure.h:951

References FactionTemplateEntry::faction, FACTION_TEMPLATE_FLAG_ATTACK_PVP_ACTIVE_PLAYERS, FACTION_TEMPLATE_FLAG_HATES_ALL_EXCEPT_FRIENDS, FactionTemplateEntry::factionFlags, GetAffectingPlayer(), GetFactionTemplateEntry(), HasUnitFlag2(), FactionTemplateEntry::IsFriendlyTo(), FactionTemplateEntry::IsHostileTo(), PLAYER_FLAGS_CONTESTED_PVP, REP_FRIENDLY, REP_HOSTILE, REP_NEUTRAL, sFactionStore, and UNIT_FLAG2_IGNORE_REPUTATION.

Referenced by GetReactionTo().

◆ GetFactionTemplateEntry()

FactionTemplateEntry const * Unit::GetFactionTemplateEntry ( ) const
6999{
7000 FactionTemplateEntry const* entry = sFactionTemplateStore.LookupEntry(GetFaction());
7001 if (!entry)
7002 {
7003 static ObjectGuid guid; // prevent repeating spam same faction problem
7004
7005 if (GetGUID() != guid)
7006 {
7007 if (Player const* player = ToPlayer())
7008 LOG_ERROR("entities.unit", "Player {} has invalid faction (faction template id) #{}", player->GetName(), GetFaction());
7009 else if (Creature const* creature = ToCreature())
7010 LOG_ERROR("entities.unit", "Creature (template id: {}) has invalid faction (faction template id) #{}", creature->GetCreatureTemplate()->Entry, GetFaction());
7011 else
7012 LOG_ERROR("entities.unit", "Unit (name={}, type={}) has invalid faction (faction template id) #{}", GetName(), uint32(GetTypeId()), GetFaction());
7013
7014 guid = GetGUID();
7015 }
7016 }
7017 return entry;
7018}
DBCStorage< FactionTemplateEntry > sFactionTemplateStore(FactionTemplateEntryfmt)
TypeID GetTypeId() const
Definition Object.h:128
uint32 GetFaction() const
Definition Unit.h:845
std::string const & GetName() const
Definition Object.h:524

References GetFaction(), Object::GetGUID(), WorldObject::GetName(), Object::GetTypeId(), LOG_ERROR, sFactionTemplateStore, Object::ToCreature(), and Object::ToPlayer().

Referenced by _IsValidAttackTarget(), Player::CanUseBattlegroundObject(), npc_necrotic_shard::DamageTaken(), HostileRefMgr::deleteReferencesForFaction(), Spell::EffectGameObjectDamage(), GetDispellableAuraList(), GetFactionReactionTo(), GetReactionTo(), Player::GetReputationPriceDiscount(), IsContestedGuard(), IsHostileToPlayers(), IsNeutralToAll(), npc_chesspiece::OnCharmed(), PatchValuesUpdate(), and RespondsToCallForHelp().

◆ GetFirstControlled()

Unit * Unit::GetFirstControlled ( ) const
8071{
8072 // Sequence: charmed, pet, other guardians
8073 Unit* unit = GetCharm();
8074 if (!unit)
8075 if (ObjectGuid guid = GetMinionGUID())
8076 unit = ObjectAccessor::GetUnit(*this, guid);
8077
8078 return unit;
8079}
ObjectGuid GetMinionGUID() const
Definition Unit.h:711

References GetCharm(), GetMinionGUID(), and ObjectAccessor::GetUnit().

Referenced by Player::CharmSpellInitialize(), CombatStart(), WorldSession::HandlePetSetAction(), and RemoveCharmedBy().

◆ GetFirstCurrentCastingSpell()

Spell * Unit::GetFirstCurrentCastingSpell ( ) const
4288{
4289 for (uint32 i = 0; i < CURRENT_MAX_SPELL; i++)
4290 if (m_currentSpells[i] && m_currentSpells[i]->GetCastTimeRemaining() > 0)
4291 return m_currentSpells[i];
4292
4293 return nullptr;
4294}

References CURRENT_MAX_SPELL, and m_currentSpells.

Referenced by ChaseMovementGenerator< T >::DoUpdate().

◆ GetFirstMinion()

Minion * Unit::GetFirstMinion ( ) const
7626{
7627 if (ObjectGuid pet_guid = GetMinionGUID())
7628 {
7629 if (Creature* pet = ObjectAccessor::GetCreatureOrPetOrVehicle(*this, pet_guid))
7630 if (pet->HasUnitTypeMask(UNIT_MASK_MINION))
7631 return (Minion*)pet;
7632
7633 LOG_ERROR("entities.unit", "Unit::GetFirstMinion: Minion {} not exist.", pet_guid.ToString());
7634 const_cast<Unit*>(this)->SetMinionGUID(ObjectGuid::Empty);
7635 }
7636
7637 return nullptr;
7638}
void SetMinionGUID(ObjectGuid guid)
Definition Unit.h:712
Creature * GetCreatureOrPetOrVehicle(WorldObject const &, ObjectGuid const &)
Definition ObjectAccessor.cpp:234

References ObjectGuid::Empty, ObjectAccessor::GetCreatureOrPetOrVehicle(), GetMinionGUID(), LOG_ERROR, SetMinionGUID(), and UNIT_MASK_MINION.

◆ GetFlatModifierValue()

float Unit::GetFlatModifierValue ( UnitMods  unitMod,
UnitModifierFlatType  modifierType 
) const

◆ GetFollowAngle()

◆ GetGameObject()

GameObject * Unit::GetGameObject ( uint32  spellId) const
6503{
6504 for (GameObjectList::const_iterator itr = m_gameObj.begin(); itr != m_gameObj.end(); ++itr)
6505 if (GameObject* go = ObjectAccessor::GetGameObject(*this, *itr))
6506 if (go->GetSpellId() == spellId)
6507 return go;
6508
6509 return nullptr;
6510}

References ObjectAccessor::GetGameObject(), and m_gameObj.

Referenced by Player::GetGameObjectIfCanInteractWith(), and Player::TeleportTo().

◆ getGender()

◆ GetGuardianPet()

Guardian * Unit::GetGuardianPet ( ) const
7641{
7642 if (ObjectGuid pet_guid = GetPetGUID())
7643 {
7644 if (Creature* pet = ObjectAccessor::GetCreatureOrPetOrVehicle(*this, pet_guid))
7645 if (pet->HasUnitTypeMask(UNIT_MASK_GUARDIAN))
7646 return (Guardian*)pet;
7647
7648 LOG_FATAL("entities.unit", "Unit::GetGuardianPet: Guardian {} not exist.", pet_guid.ToString());
7649 const_cast<Unit*>(this)->SetPetGUID(ObjectGuid::Empty);
7650 }
7651
7652 return nullptr;
7653}
#define LOG_FATAL(filterType__,...)
Definition Log.h:154
Definition TemporarySummon.h:106
void SetPetGUID(ObjectGuid guid)
Definition Unit.h:716
ObjectGuid GetPetGUID() const
Definition Unit.h:717

References ObjectGuid::Empty, ObjectAccessor::GetCreatureOrPetOrVehicle(), GetPetGUID(), LOG_FATAL, SetPetGUID(), and UNIT_MASK_GUARDIAN.

Referenced by spell_hun_check_pet_los::CheckCast(), Spell::CheckCast(), Spell::EffectSummonPet(), GetNextRandomRaidMemberOrPet(), AuraEffect::HandleAuraDummy(), HandleAuraRaidProcFromChargeWithValue(), AuraEffect::HandleModDamageDone(), WorldSession::HandlePetCastSpellOpcode(), WorldSession::HandlePetSpellAutocastOpcode(), Spell::SelectImplicitCasterObjectTargets(), and SetMinion().

◆ GetHealth()

uint32 Unit::GetHealth ( ) const
inline
@ UNIT_FIELD_HEALTH
Definition UpdateFields.h:96

References Object::GetUInt32Value(), and UNIT_FIELD_HEALTH.

Referenced by Player::_SaveCharacter(), spell_yogg_saron_protective_gaze_aura::Absorb(), spell_pri_guardian_spirit::Absorb(), spell_rog_cheat_death::Absorb(), spell_pal_ardent_defender::Absorb(), boss_twilight_halion::boss_twilight_halionAI::boss_twilight_halionAI(), WorldSession::BuildPartyMemberStatsChangedPacket(), SpellInfo::CalcPowerCost(), Spell::CheckPower(), CountPctFromCurHealth(), ScriptedAI::DamageTaken(), boss_eregos::boss_eregosAI::DamageTaken(), boss_razorgore::boss_razorgoreAI::DamageTaken(), boss_majordomo::boss_majordomoAI::DamageTaken(), boss_ragnaros::boss_ragnarosAI::DamageTaken(), npc_mc_core_hound::npc_mc_core_houndAI::DamageTaken(), boss_attumen::DamageTaken(), boss_midnight::DamageTaken(), boss_julianne::DamageTaken(), boss_romulo::DamageTaken(), boss_apothecary_hummel::boss_apothecary_hummelAI::DamageTaken(), boss_muru::DamageTaken(), npc_dark_fiend::DamageTaken(), npc_bh_thalorien_dawnseeker::npc_bh_thalorien_dawnseekerAI::DamageTaken(), boss_headless_horseman::DamageTaken(), boss_headless_horseman_head::DamageTaken(), boss_eadric::boss_eadricAI::DamageTaken(), boss_paletress::boss_paletressAI::DamageTaken(), npc_argent_soldier::npc_argent_soldierAI::DamageTaken(), boss_black_knight::boss_black_knightAI::DamageTaken(), boss_grand_champion::boss_grand_championAI::DamageTaken(), npc_announcer_toc5::npc_announcer_toc5AI::DamageTaken(), npc_frost_sphere::npc_frost_sphereAI::DamageTaken(), boss_ick::boss_ickAI::DamageTaken(), npc_pos_deathwhisper_necrolyte::npc_pos_deathwhisper_necrolyteAI::DamageTaken(), boss_drakkari_colossus::boss_drakkari_colossusAI::DamageTaken(), npc_gunship::npc_gunshipAI::DamageTaken(), npc_high_overlord_saurfang_igb::npc_high_overlord_saurfang_igbAI::DamageTaken(), npc_muradin_bronzebeard_igb::npc_muradin_bronzebeard_igbAI::DamageTaken(), npc_terenas_menethil::npc_terenas_menethilAI::DamageTaken(), boss_valithria_dreamwalker::boss_valithria_dreamwalkerAI::DamageTaken(), npc_crystalline_frayer::DamageTaken(), npc_collapsing_star::DamageTaken(), boss_freya::DamageTaken(), boss_hodir::DamageTaken(), npc_ulduar_leviathan_mkii::DamageTaken(), npc_ulduar_vx001::DamageTaken(), npc_ulduar_aerial_command_unit::DamageTaken(), boss_yoggsaron_immortal_guardian::DamageTaken(), boss_ingvar_the_plunderer::DamageTaken(), npc_vrykul_skeleton::DamageTaken(), npc_wild_wyrm::DamageTaken(), npc_overlord_drakuru_betrayal::DamageTaken(), npc_akama_illidan::DamageTaken(), npc_maiev_illidan::DamageTaken(), boss_illidari_council::DamageTaken(), boss_illidari_council_memberAI::DamageTaken(), boss_essence_of_suffering::boss_essence_of_sufferingAI::DamageTaken(), boss_essence_of_desire::boss_essence_of_desireAI::DamageTaken(), npc_akama_shade::DamageTaken(), boss_the_lurker_below::DamageTaken(), npc_shattered_hand_scout::DamageTaken(), boss_alar::DamageTaken(), advisor_baseAI::DamageTaken(), npc_magister_aledis::DamageTaken(), npc_hor_leader_second::npc_hor_leader_secondAI::DamageTaken(), npc_ice_tomb::npc_ice_tombAI::DamageTaken(), npc_blistering_zombie::npc_blistering_zombieAI::DamageTaken(), npc_molten_golem::DamageTaken(), boss_nightbane::DamageTaken(), boss_thekal::DamageTaken(), boss_felblood_kaelthas::DamageTaken(), boss_anub_arak::DamageTaken(), boss_razorscale::DamageTaken(), boss_illidan_stormrage::DamageTaken(), npc_garr_firesworn::npc_garr_fireswornAI::DamageTaken(), npc_death_knight_initiate::npc_death_knight_initiateAI::DamageTaken(), boss_the_lich_king::boss_the_lich_kingAI::DamageTaken(), SmartAI::DamageTaken(), boss_mal_ganis::boss_mal_ganisAI::DamageTaken(), boss_kologarn::DamageTaken(), boss_kologarn_arms::DamageTaken(), boss_thorim::DamageTaken(), boss_yoggsaron_sara::DamageTaken(), DealDamage(), DealDamageShieldDamage(), boss_xt002::DoAction(), boss_ichoron::boss_ichoronAI::DoAction(), npc_the_scourge_cauldron::npc_the_scourge_cauldronAI::DoDie(), Spell::EffectHealMaxHealth(), Spell::EffectInstaKill(), Pet::FillPetInfo(), boss_supremus::FindHatefulStrikeTarget(), GetHealthGain(), GetHealthPct(), spell_illidari_council_empyreal_balance::HandleAfterCast(), spell_illidari_council_empyreal_equivalency::HandleAfterCast(), AuraEffect::HandleAuraModIncreaseHealth(), AuraEffect::HandleAuraModIncreaseMaxHealth(), spell_rajaxx_thundercrash::HandleDamageCalc(), misc_commandscript::HandleDieCommand(), spell_oculus_soar_aura::HandleEffectPeriodic(), Player::HandleFall(), npc_commandscript::HandleNpcInfoCommand(), spell_dk_pet_scaling::HandlePeriodic(), spell_hun_generic_scaling::HandlePeriodic(), spell_mage_pet_scaling::HandlePeriodic(), spell_sha_feral_spirit_scaling::HandlePeriodic(), spell_warl_generic_scaling::HandlePeriodic(), AuraEffect::HandlePeriodicDamageAurasTick(), AuraEffect::HandlePeriodicHealthFunnelAuraTick(), AuraEffect::HandlePeriodicHealthLeechAuraTick(), AuraEffect::HandlePeriodicTriggerSpellAuraTick(), spell_item_blood_draining_enchant::HandleProc(), WorldSession::HandleRequestPartyMemberStatsOpcode(), ArenaSpectator::HandleResetCommand(), HealthAbovePct(), HealthAbovePctHealed(), HealthBelowPct(), HealthBelowPctDamaged(), IsFullHealth(), npc_dirt_mound::JustSummoned(), boss_attumen::JustSummoned(), boss_baltharus_the_warborn::boss_baltharus_the_warbornAI::JustSummoned(), Kill(), ModifyHealth(), spell_xt002_gravity_bomb_aura::OnPeriodic(), Acore::MostHPMissingInRange::operator()(), Acore::MostHPMissingGroupInRange::operator()(), Acore::HealthPctOrderPred::operator()(), Acore::HealthPctOrderPred::operator()(), spell_gluth_decimate_damage::PrepareSpellScript(), boss_priestess_lackey_commonAI::RecalculateThreat(), boss_faction_championsAI::RecalculateThreat(), Creature::RegenerateHealth(), Player::RegenerateHealth(), Creature::ResetPlayerDamageReq(), Player::SaveHealthBeforeDuel(), Pet::SavePetToDB(), Creature::SaveToDB(), SendAttackStateUpdate(), SendSpellNonMeleeDamageLog(), SendSpellNonMeleeReflectLog(), SetMaxHealth(), boss_eadric::boss_eadricAI::SpellHit(), boss_headless_horseman_head::SpellHitTarget(), boss_malchezaar::SpellHitTarget(), boss_ouro::Submerge(), Aura::Update(), boss_headless_horseman::UpdateAI(), boss_prince_valanar_icc::boss_prince_valanarAI::UpdateAI(), boss_valithria_dreamwalker::boss_valithria_dreamwalkerAI::UpdateAI(), boss_patchwerk::boss_patchwerkAI::UpdateAI(), boss_flame_leviathan_defense_turret::UpdateAI(), boss_razorscale::UpdateAI(), boss_ymiron::boss_ymironAI::UpdateAI(), npc_dragonmaw_peon::npc_dragonmaw_peonAI::UpdateAI(), npc_injured_patient::npc_injured_patientAI::UpdateAI(), Player::UpdateCharmedAI(), Creature::UpdateEntry(), and boss_twin_valkyrAI::UpdateSharedHealth().

◆ GetHealthGain()

int32 Unit::GetHealthGain ( int32  dVal)
11072{
11073 int32 gain = 0;
11074
11075 if (dVal == 0)
11076 return 0;
11077
11078 int32 curHealth = (int32)GetHealth();
11079
11080 int32 val = dVal + curHealth;
11081 if (val <= 0)
11082 {
11083 return -curHealth;
11084 }
11085
11086 int32 maxHealth = (int32)GetMaxHealth();
11087
11088 if (val < maxHealth)
11089 gain = dVal;
11090 else if (curHealth != maxHealth)
11091 gain = maxHealth - curHealth;
11092
11093 return gain;
11094}

References GetHealth(), and GetMaxHealth().

Referenced by Spell::DoAllEffectOnTarget().

◆ GetHealthPct()

◆ GetHighestExclusiveSameEffectSpellGroupValue()

int32 Unit::GetHighestExclusiveSameEffectSpellGroupValue ( AuraEffect const *  aurEff,
AuraType  auraType,
bool  checkMiscValue = false,
int32  miscValue = 0 
) const
4507{
4508 int32 val = 0;
4509 SpellSpellGroupMapBounds spellGroup = sSpellMgr->GetSpellSpellGroupMapBounds(aurEff->GetSpellInfo()->GetFirstRankSpell()->Id);
4510 for (SpellSpellGroupMap::const_iterator itr = spellGroup.first; itr != spellGroup.second ; ++itr)
4511 {
4512 if (sSpellMgr->GetSpellGroupStackRule(itr->second) == SPELL_GROUP_STACK_RULE_EXCLUSIVE_SAME_EFFECT)
4513 {
4514 AuraEffectList const& auraEffList = GetAuraEffectsByType(auraType);
4515 for (AuraEffectList::const_iterator auraItr = auraEffList.begin(); auraItr != auraEffList.end(); ++auraItr)
4516 {
4517 if (aurEff != (*auraItr) && (!checkMiscValue || (*auraItr)->GetMiscValue() == miscValue) &&
4518 sSpellMgr->IsSpellMemberOfSpellGroup((*auraItr)->GetSpellInfo()->Id, itr->second))
4519 {
4520 // absolute value only
4521 if (abs(val) < abs((*auraItr)->GetAmount()))
4522 val = (*auraItr)->GetAmount();
4523 }
4524 }
4525 }
4526 }
4527 return val;
4528}
std::pair< SpellSpellGroupMap::const_iterator, SpellSpellGroupMap::const_iterator > SpellSpellGroupMapBounds
Definition SpellMgr.h:351
@ SPELL_GROUP_STACK_RULE_EXCLUSIVE_SAME_EFFECT
Definition SpellMgr.h:362

References GetAuraEffectsByType(), SpellInfo::GetFirstRankSpell(), AuraEffect::GetSpellInfo(), SpellInfo::Id, SPELL_GROUP_STACK_RULE_EXCLUSIVE_SAME_EFFECT, and sSpellMgr.

Referenced by AuraEffect::HandleAuraModStat(), AuraEffect::HandleModCastingSpeed(), AuraEffect::HandleModCombatSpeedPct(), and AuraEffect::HandleModMeleeSpeedPct().

◆ getHostileRefMgr()

◆ GetHoverHeight()

float Unit::GetHoverHeight ( ) const
inline

◆ GetInterruptMask()

uint32 Unit::GetInterruptMask ( ) const
inline
1592{ return m_interruptMask; }

References m_interruptMask.

◆ GetLastDamagedTargetGuid()

ObjectGuid const & Unit::GetLastDamagedTargetGuid ( ) const
inline
961{ return _lastDamagedTargetGuid; }

References _lastDamagedTargetGuid.

◆ GetLastExtraAttackSpell()

uint32 Unit::GetLastExtraAttackSpell ( ) const
inline
999{ return _lastExtraAttackSpell; }

References _lastExtraAttackSpell.

◆ GetLevel()

uint8 Unit::GetLevel ( ) const
inline
@ UNIT_FIELD_LEVEL
Definition UpdateFields.h:114

References Object::GetUInt32Value(), and UNIT_FIELD_LEVEL.

Referenced by Player::_ApplyItemBonuses(), Player::_ApplyWeaponDamage(), KillRewarder::_InitGroupData(), Pet::_LoadAuras(), KillRewarder::_RewardPlayer(), KillRewarder::_RewardXP(), Player::_SaveCharacter(), Player::_SaveStats(), spell_pal_ardent_defender::Absorb(), Pet::addSpell(), Spell::AddUnitTarget(), Player::ApplyEnchantment(), AuraEffect::AuraEffect(), BattlegroundMgr::BuildBattlegroundListPacket(), WorldSession::BuildPartyMemberStatsChangedPacket(), CalcArmorReducedDamage(), SpellInfo::CalcPowerCost(), Aura::CalcProcChance(), SpellEffectInfo::CalcRadius(), spell_gen_disabled_above_63::CalculateAmount(), spell_item_arcane_shroud::CalculateAmount(), spell_item_the_eye_of_diminution::CalculateAmount(), AuraEffect::CalculateAmount(), CalculateLevelPenalty(), CalculateMeleeDamage(), Player::CalculateMinMaxDamage(), Player::CalculateQuestRewardXP(), Player::CalculateReputationGain(), Player::CalculateTalentsPoints(), SpellEffectInfo::CalcValue(), Player::CanEquipItem(), Group::CanJoinBattlegroundQueue(), Creature::CanResetTalents(), Player::CanSeeStartQuest(), Player::CanUseItem(), Player::CheckAreaExploreAndOutdoor(), spell_hun_tame_beast::CheckCast(), Spell::CheckCast(), ServerMailCondition::CheckCondition(), Spell::CheckEffectTarget(), spell_gen_proc_above_75::CheckLevel(), spell_gen_proc_reduced_above_60::CheckProc(), spell_item_green_whelp_armor::CheckProc(), Pet::CreateBaseAtTamed(), Player::CreatePet(), Player::CreatePet(), CreateTamedPetFrom(), CreateTamedPetFrom(), DealMeleeDamage(), DoLowUnlearnCost(), DoMedUnlearnCost(), Spell::DoSpellHitOnUnit(), Spell::EffectAddHonor(), Spell::EffectApplyGlyph(), Spell::EffectDuel(), Spell::EffectEnergize(), Spell::EffectSchoolDMG(), Spell::EffectSkinning(), Spell::EffectTameCreature(), Pet::FillPetInfo(), spell_gen_filter_party_level_80::FilterTargets(), lfg::LFGMgr::FinishDungeon(), Acore::XP::Gain(), Player::GetAverageItemLevel(), Player::GetAverageItemLevelForDF(), Player::GetBarberShopCost(), Player::GetBGAccessByLevel(), Pet::GetCurrentFoodBenefitLevel(), npc_wg_quest_giver::GetDialogStatus(), Player::GetDodgeFromAgility(), GetEffectiveResistChance(), SocialMgr::GetFriendInfo(), getLevelForTarget(), Creature::getLevelForTarget(), GetMaxSkillValueForLevel(), Player::GetMeleeCritFromAgility(), Pet::GetNativeObjectScale(), Player::GetQuestDialogStatus(), Player::GetQuestLevel(), Player::GetRatingMultiplier(), Creature::GetShieldBlockValue(), Player::GetSpellCritFromIntellect(), Trainer::Trainer::GetSpellState(), Player::GetsRecruitAFriendBonus(), GetUnitMeleeSkill(), Player::GiveLevel(), Pet::GivePetLevel(), Pet::GivePetXP(), Player::GiveXP(), WorldSession::HandleAcceptGrantLevel(), OutdoorPvPSI::HandleAreaTrigger(), WorldSession::HandleArenaTeamInviteOpcode(), WorldSession::HandleAuctionListItems(), Aura::HandleAuraSpecificMods(), WorldSession::HandleBattleFieldPortOpcode(), WorldSession::HandleBattlefieldStatusOpcode(), WorldSession::HandleBattlemasterJoinArena(), WorldSession::HandleBattlemasterJoinOpcode(), WorldSession::HandleCastSpellOpcode(), Player::HandleDrowning(), WorldSession::HandleGrantLevel(), WorldSession::HandleGroupInviteOpcode(), WorldSession::HandleLfgPlayerLockInfoRequestOpcode(), Guild::HandleMemberDepositMoney(), Guild::HandleMemberWithdrawMoney(), WorldSession::HandleMessagechatOpcode(), npc_commandscript::HandleNpcInfoCommand(), WorldSession::HandleOfferPetitionOpcode(), WorldSession::HandlePetitionBuyOpcode(), WorldSession::HandlePetitionSignOpcode(), misc_commandscript::HandlePInfoCommand(), WorldSession::HandlePlayerLoginFromDB(), spell_pri_divine_aegis::HandleProc(), WorldSession::HandleRequestPartyMemberStatsOpcode(), reset_commandscript::HandleResetLevelCommand(), spell_wintergrasp_portal::HandleScript(), spell_item_scroll_of_recall::HandleScript(), WorldSession::HandleSendMail(), player_settings_commandscript::HandleSettingsAnnouncerFlags(), Player::InitGlyphsForLevel(), lfg::LFGMgr::InitializeLockedDungeons(), Pet::InitLevelupSpellsForLevel(), Puppet::InitStats(), TempSummon::InitStats(), Player::InitStatsForLevel(), Pet::InitTalentForLevel(), Player::InitTaxiNodesForLevel(), Battlefield::InvitePlayerToWar(), Player::isHonorOrXPTarget(), Player::IsMaxLevel(), Player::LearnDefaultSkill(), Pet::LoadPetFromDB(), WorldSession::LogoutPlayer(), AchievementCriteriaData::Meets(), MeleeSpellHitResult(), npc_eagle_trash_aggro_trigger::MoveInLineOfSight(), Player::OCTRegenHPPerSpirit(), Player::OCTRegenMPPerSpirit(), spell_item_with_mount_speed::OnApply(), item_generic_limit_chance_above_60::OnCastItemCombatSpell(), npc_prof_alchemy::OnGossipHello(), npc_prof_blacksmith::OnGossipHello(), npc_prof_leather::OnGossipHello(), npc_prof_tailor::OnGossipHello(), go_evil_book_for_dummies::OnGossipHello(), Player::OnGossipSelect(), QuestApprenticeAnglerPlayerScript::OnPlayerCompleteQuest(), near_scarshield_infiltrator::OnTrigger(), at_scarshield_infiltrator::OnTrigger(), Player::PrepareGossipMenu(), Player::Regenerate(), Player::RegenerateHealth(), Player::RemovedInsignia(), Pet::removeSpell(), Pet::resetTalents(), Player::ResurrectPlayer(), Player::RewardHonor(), Player::RewardQuest(), RewardRage(), Player::RewardReputation(), RollMeleeOutcomeAgainst(), ArenaTeam::Roster(), Player::Satisfy(), Player::SatisfyQuestLevel(), Pet::SavePetToDB(), CalendarMgr::SendCalendarEvent(), CalendarMgr::SendCalendarEventInvite(), WorldSession::SendLfgPlayerReward(), WorldSession::SendLfgRoleCheckUpdate(), Player::SendLoot(), PlayerMenu::SendQuestGiverOfferReward(), PlayerMenu::SendQuestGiverQuestDetails(), PlayerMenu::SendQuestQueryResponse(), Player::SendQuestReward(), Player::SetRestBonus(), Guild::Member::SetStats(), SpellPctDamageModsDone(), Spell::SummonGuardian(), Player::SummonPet(), Pet::SynchronizeLevelWithOwner(), Aura::Update(), npc_pet_hunter_snake_trap::UpdateAI(), Player::UpdateAttackPowerAndDamage(), Player::UpdateCombatSkills(), Creature::UpdateEntry(), lfg::LFGMgr::UpdateRaidBrowser(), and GameObject::Use().

◆ getLevelForTarget()

◆ GetMagicHitRedirectTarget()

Unit * Unit::GetMagicHitRedirectTarget ( Unit victim,
SpellInfo const *  spellInfo 
)
8015{
8016 // Patch 1.2 notes: Spell Reflection no longer reflects abilities
8017 if (spellInfo->HasAttribute(SPELL_ATTR0_IS_ABILITY) || spellInfo->HasAttribute(SPELL_ATTR1_NO_REDIRECTION) || spellInfo->HasAttribute(SPELL_ATTR0_NO_IMMUNITIES))
8018 return victim;
8019
8021 for (Unit::AuraEffectList::const_iterator itr = magnetAuras.begin(); itr != magnetAuras.end(); ++itr)
8022 {
8023 if (Unit* magnet = (*itr)->GetBase()->GetUnitOwner())
8024 if (spellInfo->CheckExplicitTarget(this, magnet) == SPELL_CAST_OK
8025 //&& spellInfo->CheckTarget(this, magnet, false) == SPELL_CAST_OK
8026 && _IsValidAttackTarget(magnet, spellInfo)
8027 /*&& IsWithinLOSInMap(magnet)*/)
8028 {
8029 // Xinef: We should choose minimum between flight time and queue time as in reflect, however we dont know flight time at this point, use arbitrary small number
8030 magnet->m_Events.AddEvent(new RedirectSpellEvent(*magnet, victim->GetGUID(), *itr), magnet->m_Events.CalculateQueueTime(100));
8031
8032 if (magnet->IsTotem())
8033 {
8034 uint64 queueTime = magnet->m_Events.CalculateQueueTime(100);
8035 if (spellInfo->Speed > 0.0f)
8036 {
8037 float dist = GetDistance(magnet->GetPositionX(), magnet->GetPositionY(), magnet->GetPositionZ());
8038 if (dist < 5.0f)
8039 dist = 5.0f;
8040 queueTime = magnet->m_Events.CalculateTime((uint64)std::floor(dist / spellInfo->Speed * 1000.0f));
8041 }
8042
8043 magnet->m_Events.AddEvent(new KillMagnetEvent(*magnet), queueTime);
8044 }
8045
8046 return magnet;
8047 }
8048 }
8049 return victim;
8050}
@ SPELL_ATTR1_NO_REDIRECTION
Definition SharedDefines.h:433
@ SPELL_ATTR0_IS_ABILITY
Definition SharedDefines.h:397
@ SPELL_AURA_SPELL_MAGNET
Definition SpellAuraDefines.h:159
Definition TotemAI.h:47
Definition Unit.h:2303
bool _IsValidAttackTarget(Unit const *target, SpellInfo const *bySpell, WorldObject const *obj=nullptr) const
Definition Unit.cpp:10810
float GetDistance(WorldObject const *obj) const
Definition Object.cpp:1271

References _IsValidAttackTarget(), SpellInfo::CheckExplicitTarget(), GetAuraEffectsByType(), WorldObject::GetDistance(), Object::GetGUID(), SpellInfo::HasAttribute(), SpellInfo::Speed, SPELL_ATTR0_IS_ABILITY, SPELL_ATTR0_NO_IMMUNITIES, SPELL_ATTR1_NO_REDIRECTION, SPELL_AURA_SPELL_MAGNET, and SPELL_CAST_OK.

Referenced by Spell::SelectExplicitTargets().

◆ GetMaxHealth()

uint32 Unit::GetMaxHealth ( ) const
inline
@ UNIT_FIELD_MAXHEALTH
Definition UpdateFields.h:104

References Object::GetUInt32Value(), and UNIT_FIELD_MAXHEALTH.

Referenced by Player::_SaveStats(), Battleground::AddPlayer(), boss_twin_valkyrAI::boss_twin_valkyrAI(), boss_viscidus::boss_viscidus(), WorldSession::BuildPartyMemberStatsChangedPacket(), spell_item_skull_of_impeding_doom::CalculateDamageAmount(), CountPctFromMaxHealth(), boss_eregos::boss_eregosAI::DamageTaken(), npc_dark_fiend::DamageTaken(), boss_black_knight::boss_black_knightAI::DamageTaken(), boss_alar::DamageTaken(), npc_molten_golem::DamageTaken(), boss_razorscale::DamageTaken(), boss_viscidus::DamageTaken(), boss_twinemperorsAI::DamageTaken(), boss_thorim_start_npcs::DamageTaken(), npc_heated_battle::npc_heated_battleAI::DamageTaken(), boss_thorim::DamageTaken(), boss_yoggsaron_sara::DamageTaken(), boss_prince_valanar_icc::boss_prince_valanarAI::DoAction(), npc_terenas_menethil::npc_terenas_menethilAI::DoAction(), boss_grand_champion::boss_grand_championAI::DoAction(), boss_thaddius_summon::boss_thaddius_summonAI::DoAction(), boss_xt002::DoAction(), npc_xt002_heart::DoAction(), boss_yoggsaron::DoAction(), Spell::EffectHealMaxHealth(), Spell::EffectSummonPet(), boss_prince_keleseth_icc::boss_prince_kelesethAI::EnterEvadeMode(), boss_prince_taldaram_icc::boss_prince_taldaramAI::EnterEvadeMode(), boss_prince_valanar_icc::boss_prince_valanarAI::EnterEvadeMode(), Acore::XP::Gain(), GetHealthGain(), GetHealthPct(), npc_echo_of_medivh::GetPiece(), spell_illidari_council_empyreal_balance::HandleAfterCast(), AuraEffect::HandleAuraModIncreaseHealthPercent(), AuraEffect::HandleAuraModIncreaseMaxHealth(), misc_commandscript::HandleDamageCommand(), misc_commandscript::HandleDieCommand(), Player::HandleDrowning(), spell_oculus_soar_aura::HandleEffectPeriodic(), Player::HandleFall(), spell_pal_lay_on_hands::HandleMaxHealthHeal(), AuraEffect::HandleModTotalPercentStat(), npc_commandscript::HandleNpcInfoCommand(), spell_dru_frenzied_regeneration::HandlePeriodic(), AuraEffect::HandlePeriodicDamageAurasTick(), AuraEffect::HandlePeriodicTriggerSpellAuraTick(), npc_echo_of_medivh::HandlePieceJustDied(), spell_sha_nature_guardian::HandleProc(), spell_warr_item_t10_prot_4p_bonus::HandleProc(), WorldSession::HandleRequestPartyMemberStatsOpcode(), ArenaSpectator::HandleResetCommand(), spell_stinky_precious_decimate::HandleScript(), IsFullHealth(), boss_twin_valkyrAI::JustEngagedWith(), boss_sister_svalna::boss_sister_svalnaAI::JustEngagedWith(), boss_ingvar_the_plunderer::JustEngagedWith(), boss_prince_keleseth_icc::boss_prince_kelesethAI::JustEngagedWith(), boss_prince_taldaram_icc::boss_prince_taldaramAI::JustEngagedWith(), boss_prince_valanar_icc::boss_prince_valanarAI::JustEngagedWith(), boss_prince_valanar_icc::boss_prince_valanarAI::JustReachedHome(), npc_dirt_mound::JustSummoned(), boss_skeram::JustSummoned(), boss_drakkari_colossus::boss_drakkari_colossusAI::JustSummoned(), boss_gluth::boss_gluthAI::KilledUnit(), Creature::LoadCreatureFromDB(), Player::LoadFromDB(), Pet::LoadPetFromDB(), ModifyHealth(), npc_xt002_life_spark::npc_xt002_life_spark(), instance_karazhan::instance_karazhan_InstanceMapScript::OnCreatureCreate(), instance_halls_of_reflection::instance_halls_of_reflection_InstanceMapScript::OnCreatureCreate(), Acore::MostHPMissingInRange::operator()(), Acore::MostHPMissingGroupInRange::operator()(), Acore::HealthPctOrderPred::operator()(), Acore::HealthPctOrderPred::operator()(), Player::outDebugValues(), Player::ProcessDelayedOperations(), SmartScript::ProcessEvent(), boss_priestess_lackey_commonAI::RecalculateThreat(), boss_faction_championsAI::RecalculateThreat(), Creature::RegenerateHealth(), Player::RegenerateHealth(), boss_prince_keleseth_icc::boss_prince_kelesethAI::Reset(), boss_prince_taldaram_icc::boss_prince_taldaramAI::Reset(), boss_prince_valanar_icc::boss_prince_valanarAI::Reset(), boss_valithria_dreamwalker::boss_valithria_dreamwalkerAI::Reset(), Player::ResetAllPowers(), Player::ResurectUsingRequestData(), Player::ResurrectPlayer(), SetFullHealth(), SetHealth(), boss_headless_horseman::SpellHit(), npc_necrotic_shard::SpellHit(), boss_black_knight::boss_black_knightAI::SpellHitTarget(), npc_simon_bunny::npc_simon_bunnyAI::SpellHitTarget(), npc_giant_claw_tentacle::Submerge(), boss_drakkari_colossus::boss_drakkari_colossusAI::SummonedCreatureDespawn(), boss_viscidus::SummonedCreatureDies(), boss_headless_horseman::UpdateAI(), npc_nerubian_burrower::npc_nerubian_burrowerAI::UpdateAI(), npc_snobold_vassal::npc_snobold_vassalAI::UpdateAI(), npc_hor_lich_king::npc_hor_lich_kingAI::UpdateAI(), boss_garfrost::boss_garfrostAI::UpdateAI(), boss_ick::boss_ickAI::UpdateAI(), boss_tyrannus::boss_tyrannusAI::UpdateAI(), boss_valithria_dreamwalker::boss_valithria_dreamwalkerAI::UpdateAI(), boss_flame_leviathan_defense_turret::UpdateAI(), boss_razorscale::UpdateAI(), boss_ymiron::boss_ymironAI::UpdateAI(), npc_boneguard_footman::npc_boneguard_footmanAI::UpdateAI(), npc_target_dummy::npc_target_dummyAI::UpdateAI(), Creature::UpdateEntry(), and lfg::LFGMgr::UpdateRaidBrowser().

◆ GetMaxNegativeAuraModifier() [1/2]

int32 Unit::GetMaxNegativeAuraModifier ( AuraType  auratype) const

◆ GetMaxNegativeAuraModifier() [2/2]

int32 Unit::GetMaxNegativeAuraModifier ( AuraType  auraType,
std::function< bool(AuraEffect const *)> const &  predicate 
) const
6217{
6218 AuraEffectList const& mTotalAuraList = GetAuraEffectsByType(auraType);
6219 if (mTotalAuraList.empty())
6220 return 0;
6221
6222 int32 modifier = 0;
6223 for (AuraEffect const* aurEff : mTotalAuraList)
6224 {
6225 if (predicate(aurEff))
6226 modifier = std::min(modifier, aurEff->GetAmount());
6227 }
6228
6229 return modifier;
6230}

References GetAuraEffectsByType().

◆ GetMaxNegativeAuraModifierByAffectMask()

int32 Unit::GetMaxNegativeAuraModifierByAffectMask ( AuraType  auratype,
SpellInfo const *  affectedSpell 
) const
6363{
6364 return GetMaxNegativeAuraModifier(auraType, [affectedSpell](AuraEffect const* aurEff) -> bool
6365 {
6366 if (aurEff->IsAffectedOnSpell(affectedSpell))
6367 return true;
6368 return false;
6369 });
6370}

References GetMaxNegativeAuraModifier(), and AuraEffect::IsAffectedOnSpell().

◆ GetMaxNegativeAuraModifierByMiscMask()

int32 Unit::GetMaxNegativeAuraModifierByMiscMask ( AuraType  auratype,
uint32  misc_mask 
) const
6283{
6284 return GetMaxNegativeAuraModifier(auraType, [miscMask](AuraEffect const* aurEff) -> bool
6285 {
6286 if ((aurEff->GetMiscValue() & miscMask) != 0)
6287 return true;
6288 return false;
6289 });
6290}

References GetMaxNegativeAuraModifier(), and AuraEffect::GetMiscValue().

Referenced by SpellTakenCritChance().

◆ GetMaxNegativeAuraModifierByMiscValue()

int32 Unit::GetMaxNegativeAuraModifierByMiscValue ( AuraType  auratype,
int32  misc_value 
) const
6323{
6324 return GetMaxNegativeAuraModifier(auraType, [miscValue](AuraEffect const* aurEff) -> bool
6325 {
6326 if (aurEff->GetMiscValue() == miscValue)
6327 return true;
6328 return false;
6329 });
6330}

References GetMaxNegativeAuraModifier(), and AuraEffect::GetMiscValue().

Referenced by MagicSpellHitResult(), and ModSpellDuration().

◆ GetMaxPositiveAuraModifier() [1/2]

◆ GetMaxPositiveAuraModifier() [2/2]

int32 Unit::GetMaxPositiveAuraModifier ( AuraType  auraType,
std::function< bool(AuraEffect const *)> const &  predicate 
) const
6201{
6202 AuraEffectList const& mTotalAuraList = GetAuraEffectsByType(auraType);
6203 if (mTotalAuraList.empty())
6204 return 0;
6205
6206 int32 modifier = 0;
6207 for (AuraEffect const* aurEff : mTotalAuraList)
6208 {
6209 if (predicate(aurEff))
6210 modifier = std::max(modifier, aurEff->GetAmount());
6211 }
6212
6213 return modifier;
6214}

References GetAuraEffectsByType().

◆ GetMaxPositiveAuraModifierByAffectMask()

int32 Unit::GetMaxPositiveAuraModifierByAffectMask ( AuraType  auratype,
SpellInfo const *  affectedSpell 
) const
6353{
6354 return GetMaxPositiveAuraModifier(auraType, [affectedSpell](AuraEffect const* aurEff) -> bool
6355 {
6356 if (aurEff->IsAffectedOnSpell(affectedSpell))
6357 return true;
6358 return false;
6359 });
6360}

References GetMaxPositiveAuraModifier(), and AuraEffect::IsAffectedOnSpell().

◆ GetMaxPositiveAuraModifierByMiscMask()

int32 Unit::GetMaxPositiveAuraModifierByMiscMask ( AuraType  auratype,
uint32  misc_mask,
const AuraEffect except = nullptr 
) const
6273{
6274 return GetMaxPositiveAuraModifier(auraType, [miscMask, except](AuraEffect const* aurEff) -> bool
6275 {
6276 if (except != aurEff && (aurEff->GetMiscValue() & miscMask) != 0)
6277 return true;
6278 return false;
6279 });
6280}

References GetMaxPositiveAuraModifier(), and AuraEffect::GetMiscValue().

Referenced by CalcAbsorbResist(), AuraEffect::HandleAuraModResistanceExclusive(), SpellTakenCritChance(), and UpdateResistanceBuffModsMod().

◆ GetMaxPositiveAuraModifierByMiscValue()

int32 Unit::GetMaxPositiveAuraModifierByMiscValue ( AuraType  auratype,
int32  misc_value 
) const
6313{
6314 return GetMaxPositiveAuraModifier(auraType, [miscValue](AuraEffect const* aurEff) -> bool
6315 {
6316 if (aurEff->GetMiscValue() == miscValue)
6317 return true;
6318 return false;
6319 });
6320}

References GetMaxPositiveAuraModifier(), and AuraEffect::GetMiscValue().

Referenced by MagicSpellHitResult().

◆ GetMaxPower()

uint32 Unit::GetMaxPower ( Powers  power) const
inline
1125{ return GetUInt32Value(static_cast<uint16>(UNIT_FIELD_MAXPOWER1) + power); }
@ UNIT_FIELD_MAXPOWER1
Definition UpdateFields.h:105

References Object::GetUInt32Value(), and UNIT_FIELD_MAXPOWER1.

Referenced by Player::_SaveStats(), WorldSession::BuildPartyMemberStatsChangedPacket(), SpellInfo::CalcPowerCost(), spell_gen_replenishment_aura::CalculateAmount(), spell_item_skull_of_impeding_doom::CalculateManaLeechAmount(), Spell::CheckItems(), Player::Create(), boss_shade_of_aran::DamageTaken(), Spell::EffectEnergize(), Spell::EffectEnergizePct(), Spell::EffectPowerBurn(), Spell::EffectResurrect(), Spell::EffectSelfResurrect(), Spell::EffectSummonPet(), GetPowerPct(), Player::GiveLevel(), Aura::HandleAuraSpecificMods(), modify_commandscript::HandleModifyEnergyCommand(), AuraEffect::HandleObsModPowerAuraTick(), AuraEffect::HandlePeriodicEnergizeAuraTick(), AuraEffect::HandlePeriodicManaLeechAuraTick(), AuraEffect::HandlePeriodicTriggerSpellAuraTick(), spell_dru_leader_of_the_pack::HandleProc(), spell_hun_ascpect_of_the_viper::HandleProc(), spell_mage_magic_absorption::HandleProc(), spell_warl_improved_drain_soul::HandleProc(), WorldSession::HandleRequestPartyMemberStatsOpcode(), ArenaSpectator::HandleResetCommand(), spell_kelthuzad_detonate_mana_aura::HandleScript(), Player::InitStatsForLevel(), Guardian::InitStatsForLevel(), boss_curator::JustEngagedWith(), Creature::LoadCreatureFromDB(), Player::LoadFromDB(), Pet::LoadPetFromDB(), ModifyPower(), boss_shade_of_aran::OnPowerUpdate(), boss_selin_fireheart::OnPowerUpdate(), Acore::PowerPctOrderPred::operator()(), Acore::PowerPctOrderPred::operator()(), Player::outDebugValues(), spell_item_oracle_ablutions::PrepareSpellScript(), Player::ProcessDelayedOperations(), SmartScript::ProcessEvent(), spell_bronjahm_magic_bane::RecalculateDamage(), Creature::Regenerate(), Player::Regenerate(), boss_curator::Reset(), boss_shade_of_aran::Reset(), boss_lady_deathwhisper::boss_lady_deathwhisperAI::Reset(), Player::ResetAllPowers(), Player::ResurectUsingRequestData(), Player::ResurrectPlayer(), SetPower(), setPowerType(), Player::SummonPet(), boss_moam::UpdateAI(), boss_faction_championsAI::UpdateAI(), boss_thorim_start_npcs::UpdateAI(), boss_thorim_gauntlet_npcs::UpdateAI(), boss_thorim_arena_npcs::UpdateAI(), npc_dalaran_mage::npc_dalaran_mageAI::UpdateAI(), Player::UpdateCharmedAI(), and lfg::LFGMgr::UpdateRaidBrowser().

◆ GetMaxSkillValueForLevel()

uint16 Unit::GetMaxSkillValueForLevel ( Unit const *  target = nullptr) const
inline
1193{ return (target ? getLevelForTarget(target) : GetLevel()) * 5; }
uint8 getLevelForTarget(WorldObject const *) const override
Definition Unit.h:1093

References GetLevel(), and getLevelForTarget().

Referenced by Player::GetMaxSkillValueForLevel(), GetUnitCriticalChance(), GetWeaponSkillValue(), isSpellBlocked(), MeleeSpellHitResult(), RollMeleeOutcomeAgainst(), RollMeleeOutcomeAgainst(), and SpellTakenCritChance().

◆ GetMechanicResistChance()

int32 Unit::GetMechanicResistChance ( SpellInfo const *  spell)
3264{
3265 if (!spell)
3266 return 0;
3267 int32 resist_mech = 0;
3268 for (uint8 eff = 0; eff < MAX_SPELL_EFFECTS; ++eff)
3269 {
3270 if (!spell->Effects[eff].IsEffect())
3271 break;
3272 int32 effect_mech = spell->GetEffectMechanic(eff);
3273 if (effect_mech)
3274 {
3276 if (resist_mech < temp)
3277 resist_mech = temp;
3278 }
3279 }
3280 return resist_mech;
3281}
@ SPELL_AURA_MOD_MECHANIC_RESISTANCE
Definition SpellAuraDefines.h:180
int32 GetTotalAuraModifierByMiscValue(AuraType auratype, int32 misc_value) const
Definition Unit.cpp:6292

References SpellInfo::Effects, SpellInfo::GetEffectMechanic(), GetTotalAuraModifierByMiscValue(), MAX_SPELL_EFFECTS, and SPELL_AURA_MOD_MECHANIC_RESISTANCE.

Referenced by MagicSpellHitResult(), and MeleeSpellHitResult().

◆ GetMeleeAttackPoint()

bool Unit::GetMeleeAttackPoint ( Unit attacker,
Position pos 
)
2800{
2801 if (!attacker)
2802 {
2803 return false;
2804 }
2805
2806 AttackerSet attackers = getAttackers();
2807
2808 if (attackers.size() <= 1) // if the attackers are not more than one
2809 {
2810 return false;
2811 }
2812
2813 float meleeReach = GetExactDist2d(attacker);
2814 if (meleeReach <= 0)
2815 {
2816 return false;
2817 }
2818
2819 float minAngle = 0;
2820 Unit *refUnit = nullptr;
2821 uint32 validAttackers = 0;
2822
2823 double attackerSize = attacker->GetCollisionRadius();
2824
2825 for (auto const& otherAttacker: attackers)
2826 {
2827 // if the otherAttacker is not valid, skip
2828 if (!otherAttacker || otherAttacker->GetGUID() == attacker->GetGUID() ||
2829 !otherAttacker->IsWithinMeleeRange(this) || otherAttacker->isMoving())
2830 {
2831 continue;
2832 }
2833
2834 float curretAngle = atan(attacker->GetExactDist2d(otherAttacker) / meleeReach);
2835 if (minAngle == 0 || curretAngle < minAngle)
2836 {
2837 minAngle = curretAngle;
2838 refUnit = otherAttacker;
2839 }
2840
2841 validAttackers++;
2842 }
2843
2844 if (!validAttackers || !refUnit)
2845 {
2846 return false;
2847 }
2848
2849 float contactDist = attackerSize + refUnit->GetCollisionRadius();
2850 float requiredAngle = atan(contactDist / meleeReach);
2851 float attackersAngle = atan(attacker->GetExactDist2d(refUnit) / meleeReach);
2852
2853 // in instance: the more attacker there are, the higher will be the tollerance
2854 // outside: creatures should not intersecate
2855 float angleTollerance = attacker->GetMap()->IsDungeon() ? requiredAngle - requiredAngle * tanh(validAttackers / 5.0f) : requiredAngle;
2856
2857 if (attackersAngle > angleTollerance)
2858 {
2859 return false;
2860 }
2861
2862 double angle = atan(contactDist / meleeReach);
2863
2864 float angularRadius = frand(0.1f, 0.3f) + angle;
2865 int8 direction = (urand(0, 1) ? -1 : 1);
2866 float currentAngle = GetAngle(refUnit);
2867 float absAngle = currentAngle + angularRadius * direction;
2868
2869 float x, y, z;
2870 float distance = meleeReach - GetObjectSize();
2871 GetNearPoint(attacker, x, y, z, distance, 0.0f, absAngle);
2872
2873 if (!GetMap()->CanReachPositionAndGetValidCoords(this, x, y, z, true, true))
2874 {
2875 GetNearPoint(attacker, x, y, z, distance, 0.0f, absAngle * -1); // try the other side
2876
2877 if (!GetMap()->CanReachPositionAndGetValidCoords(this, x, y, z, true, true))
2878 {
2879 return false;
2880 }
2881 }
2882
2883 pos.Relocate(x, y, z);
2884
2885 return true;
2886}
std::int8_t int8
Definition Define.h:105
float frand(float min, float max)
Definition Random.cpp:57
bool IsDungeon() const
Definition Map.h:295
float GetCollisionRadius() const override
this method gets the radius of a Unit by DB if any value is defined, otherwise it gets the value by t...
Definition Unit.cpp:17311
std::unordered_set< Unit * > AttackerSet
Definition Unit.h:660
AttackerSet const & getAttackers() const
Definition Unit.h:894
void GetNearPoint(WorldObject const *searcher, float &x, float &y, float &z, float searcher_size, float distance2d, float absAngle, float controlZ=0, Position const *startPos=nullptr) const
Definition Object.cpp:2663
float GetExactDist2d(const float x, const float y) const
Definition Position.h:170

References frand(), Position::GetAngle(), getAttackers(), GetCollisionRadius(), Position::GetExactDist2d(), Object::GetGUID(), WorldObject::GetMap(), WorldObject::GetNearPoint(), WorldObject::GetObjectSize(), Map::IsDungeon(), Position::Relocate(), and urand().

Referenced by MotionMaster::MoveCircleTarget().

◆ GetMeleeCritChanceReduction()

float Unit::GetMeleeCritChanceReduction ( ) const
inline

◆ GetMeleeCritDamageReduction()

uint32 Unit::GetMeleeCritDamageReduction ( uint32  damage) const
inline
1263{ return GetCombatRatingDamageReduction(CR_CRIT_TAKEN_MELEE, 2.2f, 33.0f, damage); }
uint32 GetCombatRatingDamageReduction(CombatRating cr, float rate, float cap, uint32 damage) const
Definition Unit.cpp:15558

References CR_CRIT_TAKEN_MELEE, and GetCombatRatingDamageReduction().

Referenced by ApplyResilience(), and processDummyAuras().

◆ GetMeleeDamageReduction()

uint32 Unit::GetMeleeDamageReduction ( uint32  damage) const
inline

◆ GetMeleeDamageSchoolMask()

virtual SpellSchoolMask Unit::GetMeleeDamageSchoolMask ( WeaponAttackType  attackType = BASE_ATTACK,
uint8  damageIndex = 0 
) const
pure virtual

Implemented in Player, and Creature.

Referenced by CalculateMeleeDamage().

◆ GetMeleeHitRedirectTarget()

Unit * Unit::GetMeleeHitRedirectTarget ( Unit victim,
SpellInfo const *  spellInfo = nullptr 
)
8053{
8055 for (AuraEffectList::const_iterator i = hitTriggerAuras.begin(); i != hitTriggerAuras.end(); ++i)
8056 {
8057 if (Unit* magnet = (*i)->GetBase()->GetCaster())
8058 if (_IsValidAttackTarget(magnet, spellInfo) && magnet->IsWithinLOSInMap(this)
8059 && (!spellInfo || (spellInfo->CheckExplicitTarget(this, magnet) == SPELL_CAST_OK
8060 && spellInfo->CheckTarget(this, magnet, false) == SPELL_CAST_OK)))
8061 if (roll_chance_i((*i)->GetAmount()))
8062 {
8063 (*i)->GetBase()->DropCharge(AURA_REMOVE_BY_EXPIRE);
8064 return magnet;
8065 }
8066 }
8067 return victim;
8068}
bool roll_chance_i(int chance)
Definition Random.h:63
@ SPELL_AURA_ADD_CASTER_HIT_TRIGGER
Definition SpellAuraDefines.h:174

References _IsValidAttackTarget(), AURA_REMOVE_BY_EXPIRE, SpellInfo::CheckExplicitTarget(), SpellInfo::CheckTarget(), GetAuraEffectsByType(), roll_chance_i(), SPELL_AURA_ADD_CASTER_HIT_TRIGGER, and SPELL_CAST_OK.

Referenced by AttackerStateUpdate(), spell_dk_dancing_rune_weapon::HandleProc(), and Spell::SelectExplicitTargets().

◆ GetMeleeRange()

float Unit::GetMeleeRange ( Unit const *  target) const
792{
793 float range = GetCombatReach() + target->GetCombatReach() + 4.0f / 3.0f;
794 return std::max(range, NOMINAL_MELEE_RANGE);
795}
#define NOMINAL_MELEE_RANGE
Definition ObjectDefines.h:47
float GetCombatReach() const override
Definition Unit.h:871

References GetCombatReach(), and NOMINAL_MELEE_RANGE.

Referenced by SmartAI::DistanceYourself(), GetRandomContactPoint(), IsWithinMeleeRange(), CreatureAI::MoveBackwardsChecks(), and SmartScript::ProcessAction().

◆ GetMeleeReach()

float Unit::GetMeleeReach ( ) const
inline
872{ float reach = m_floatValues[UNIT_FIELD_COMBATREACH]; return reach > MIN_MELEE_REACH ? reach : MIN_MELEE_REACH; }
#define MIN_MELEE_REACH
Definition ObjectDefines.h:46

References Object::m_floatValues, MIN_MELEE_REACH, and UNIT_FIELD_COMBATREACH.

Referenced by boss_veknilash::JustEngagedWith(), and npc_rookery_hatcher::npc_rookery_hatcherAI::UpdateAI().

◆ GetMinionGUID()

ObjectGuid Unit::GetMinionGUID ( ) const
inline
@ UNIT_FIELD_SUMMON
Definition UpdateFields.h:87

References Object::GetGuidValue(), and UNIT_FIELD_SUMMON.

Referenced by GetFirstControlled(), GetFirstMinion(), and OutDebugInfo().

◆ GetModelForForm()

uint32 Unit::GetModelForForm ( ShapeshiftForm  form,
uint32  spellId 
)
15565{
15566 // Hardcoded cases
15567 switch (spellId)
15568 {
15569 case 7090: // Bear form
15570 return 29414;
15571 case 35200: // Roc form
15572 return 4877;
15573 default:
15574 break;
15575 }
15576
15577 if (IsPlayer())
15578 {
15579 if (uint32 ModelId = sObjectMgr->GetModelForShapeshift(form, ToPlayer()))
15580 return ModelId;
15581 }
15582
15583 uint32 modelid = 0;
15584 SpellShapeshiftFormEntry const* formEntry = sSpellShapeshiftFormStore.LookupEntry(form);
15585 if (formEntry && formEntry->modelID_A)
15586 {
15587 // Take the alliance modelid as default
15588 if (!IsPlayer())
15589 return formEntry->modelID_A;
15590 else
15591 {
15593 modelid = formEntry->modelID_A;
15594 else
15595 modelid = formEntry->modelID_H;
15596
15597 // If the player is horde but there are no values for the horde modelid - take the alliance modelid
15598 if (!modelid && Player::TeamIdForRace(getRace()) == TEAM_HORDE)
15599 modelid = formEntry->modelID_A;
15600 }
15601 }
15602
15603 return modelid;
15604}
@ TEAM_ALLIANCE
Definition SharedDefines.h:771
@ TEAM_HORDE
Definition SharedDefines.h:772
static TeamId TeamIdForRace(uint8 race)
Definition Player.cpp:5823
uint8 getRace(bool original=false) const
Definition Unit.cpp:17217
uint32 modelID_H
Definition DBCStructure.h:1827
uint32 modelID_A
Definition DBCStructure.h:1826

References getRace(), Object::IsPlayer(), SpellShapeshiftFormEntry::modelID_A, SpellShapeshiftFormEntry::modelID_H, sObjectMgr, sSpellShapeshiftFormStore, TEAM_ALLIANCE, TEAM_HORDE, Player::TeamIdForRace(), and Object::ToPlayer().

Referenced by AuraEffect::HandleAuraModShapeshift(), AuraEffect::HandleAuraTransform(), and RestoreDisplayId().

◆ GetMotionMaster() [1/2]

MotionMaster * Unit::GetMotionMaster ( )
inline
1742{ return i_motionMaster; }

References i_motionMaster.

Referenced by _ExitVehicle(), HomeMovementGenerator< Creature >::_setTargetLocation(), PetAI::_stopAttack(), BattlegroundAV::AddAVCreature(), UnitAI::AttackStart(), FollowerAI::AttackStart(), boss_priestess_lackey_commonAI::AttackStart(), npc_high_overlord_saurfang_igb::npc_high_overlord_saurfang_igbAI::AttackStart(), npc_muradin_bronzebeard_igb::npc_muradin_bronzebeard_igbAI::AttackStart(), boss_lady_deathwhisper::boss_lady_deathwhisperAI::AttackStart(), boss_malygos::AttackStart(), npc_nexus_lord::AttackStart(), boss_swamplord_muselek::AttackStart(), ArcherAI::AttackStart(), npc_escortAI::AttackStart(), SmartAI::AttackStart(), boss_shade_of_aran::AttackStart(), npc_hyjal_ground_trash::AttackStart(), npc_hyjal_gargoyle::AttackStart(), npc_hyjal_frost_wyrm::AttackStart(), npc_icc_vengeful_fleshreaper::npc_icc_vengeful_fleshreaperAI::AttackStart(), boss_magus_telestra::AttackStart(), boss_razorscale::AttackStart(), boss_lady_malande::AttackStart(), boss_olm_the_summoner::AttackStart(), boss_kiggler_the_crazed::AttackStart(), boss_krosh_firehand::AttackStart(), npc_millhouse_manastorm::npc_millhouse_manastormAI::AttackStart(), boss_high_astromancer_solarian::AttackStart(), npc_capernian::AttackStart(), UnitAI::AttackStartCaster(), Creature::CanCreatureAttack(), boss_professor_putricide::boss_professor_putricideAI::ChangePhase(), CleanupBeforeRemoveFromMap(), boss_alar::ConstructWaypointsAndMove(), boss_isalien::DamageTaken(), boss_julianne::DamageTaken(), boss_grand_champion::boss_grand_championAI::DamageTaken(), npc_frost_sphere::npc_frost_sphereAI::DamageTaken(), boss_bronjahm::boss_bronjahmAI::DamageTaken(), npc_power_spark::DamageTaken(), boss_hodir::DamageTaken(), npc_ulduar_leviathan_mkii::DamageTaken(), npc_ulduar_aerial_command_unit::DamageTaken(), boss_ingvar_the_plunderer::DamageTaken(), npc_vrykul_skeleton::DamageTaken(), npc_wild_wyrm::DamageTaken(), boss_essence_of_suffering::boss_essence_of_sufferingAI::DamageTaken(), boss_essence_of_desire::boss_essence_of_desireAI::DamageTaken(), npc_blistering_zombie::npc_blistering_zombieAI::DamageTaken(), boss_the_lich_king::boss_the_lich_kingAI::DamageTaken(), boss_thorim::DamageTaken(), npc_weegli_blastfuse::npc_weegli_blastfuseAI::DestroyDoor(), SmartAI::DistanceYourself(), npc_icc_ice_sphere::npc_icc_ice_sphereAI::DoAction(), boss_nightbane::DoAction(), npc_apothecary_genericAI::DoAction(), npc_harrison_jones::DoAction(), npc_amanishi_lookout::DoAction(), npc_chained_spirit::DoAction(), boss_anetheron::DoAction(), boss_azgalor::DoAction(), boss_kazrogal::DoAction(), boss_rage_winterchill::DoAction(), npc_hyjal_ground_trash::DoAction(), npc_hyjal_gargoyle::DoAction(), npc_hyjal_frost_wyrm::DoAction(), npc_twilight_volunteer::DoAction(), boss_taldaram::DoAction(), npc_hadronox_crusherPackAI::DoAction(), npc_kinetic_bomb::npc_kinetic_bombAI::DoAction(), npc_high_overlord_saurfang_icc::npc_high_overlord_saurfangAI::DoAction(), npc_muradin_bronzebeard_icc::npc_muradin_bronzebeard_iccAI::DoAction(), npc_saurfang_event::npc_saurfang_eventAI::DoAction(), boss_professor_putricide::boss_professor_putricideAI::DoAction(), boss_sindragosa::boss_sindragosaAI::DoAction(), npc_spinestalker::npc_spinestalkerAI::DoAction(), npc_rimefang::npc_rimefangAI::DoAction(), npc_argent_captainAI::DoAction(), npc_icc_spire_frostwyrm::DoAction(), boss_algalon_the_observer::DoAction(), npc_brann_bronzebeard_algalon::DoAction(), npc_ahune_bunny::DoAction(), npc_pos_martin_or_gorkun_second::npc_pos_martin_or_gorkun_secondAI::DoAction(), npc_anubarak_spike::npc_anubarak_spikeAI::DoAction(), boss_tyrannus::boss_tyrannusAI::DoAction(), npc_living_mojo::npc_living_mojoAI::DoAction(), npc_power_spark::DoAction(), npc_hover_disk::DoAction(), npc_spark_of_ionar::DoAction(), boss_skadi_grauf::boss_skadi_graufAI::DoAction(), boss_ambassador_hellmaw::DoAction(), boss_illidan_stormrage::DoAction(), npc_akama_illidan::DoAction(), npc_maiev_illidan::DoAction(), npc_akama_shade::DoAction(), boss_nazan::DoAction(), boss_ghazan::DoAction(), PetAI::DoAttack(), Creature::DoFleeToGetAssistance(), npc_taskmaster_fizzule::npc_taskmaster_fizzuleAI::DoFriend(), ScriptedAI::DoStartMovement(), ScriptedAI::DoStartNoMovement(), go_commandscript::DoTeleport(), go_commandscript::DoTeleportToTransport(), Spell::EffectCharge(), Spell::EffectChargeDest(), Spell::EffectDistract(), Spell::EffectJump(), Spell::EffectJumpDest(), Spell::EffectPullTowards(), Spell::EffectSummonType(), npc_battle_at_valhalas::npc_battle_at_valhalasAI::EndBattle(), boss_jindo::EnterEvadeMode(), npc_black_morass_summoned_add::EnterEvadeMode(), boss_professor_putricide::boss_professor_putricideAI::EnterEvadeMode(), npc_argent_captainAI::EnterEvadeMode(), CreatureAI::EnterEvadeMode(), SmartAI::EnterEvadeMode(), GuardAI::EnterEvadeMode(), npc_burning_spirit::npc_burning_spiritAI::EnterEvadeMode(), boss_doomrel::boss_doomrelAI::EnterEvadeMode(), npc_varian_wrynn::npc_varian_wrynnAI::EnterEvadeMode(), npc_thrall_bfu::npc_thrall_bfuAI::EnterEvadeMode(), npc_high_overlord_saurfang_igb::npc_high_overlord_saurfang_igbAI::EnterEvadeMode(), npc_muradin_bronzebeard_igb::npc_muradin_bronzebeard_igbAI::EnterEvadeMode(), gunship_npc_AI::EnterEvadeMode(), npc_gunship_boarding_addAI::EnterEvadeMode(), violet_hold_trashAI::EnterEvadeMode(), npc_mrfloppy::npc_mrfloppyAI::EnterEvadeMode(), npc_pet_gen_argent_pony_bridle::EnterEvadeMode(), npc_pet_hunter_snake_trap::EnterEvadeMode(), npc_pet_mage_mirror_image::EnterEvadeMode(), npc_escortAI::EnterEvadeMode(), FollowerAI::EnterEvadeMode(), boss_halazzi::EnterPhase(), boss_zuljin::EnterPhase(), VehicleDespawnEvent::Execute(), RestoreAttack::Execute(), OrcMoveEvent::Execute(), NpcRunToHome::Execute(), UtherBatteredHiltEvent::Execute(), SlaveRunEvent::Execute(), DelayedMovementEvent::Execute(), DaranavanMoveEvent::Execute(), FrostwyrmLandEvent::Execute(), SACActivateEvent::Execute(), boss_kaelthas::ExecuteMiddleEvent(), AssistanceMovementGenerator::Finalize(), npc_singularity::FindAndFollowTarget(), npc_dark_iron_guzzler::FindNextKeg(), npc_hallows_end_soh::FinishEvent(), npc_pet_dk_ebon_gargoyle::FlyAway(), boss_nightbane::FlyToClosestPreFlyWayPoint(), Creature::FocusTarget(), CreatureGroup::FormationReset(), boss_volkhan::GoToAnvil(), boss_blood_queen_lana_thel::boss_blood_queen_lana_thelAI::GoToMinchar(), spell_apothecary_lingering_fumes::HandleAfterCast(), npc_anachronos_the_ancient::npc_anachronos_the_ancientAI::HandleAnimation(), npc_torloth_the_magnificent::npc_torloth_the_magnificentAI::HandleAnimation(), misc_commandscript::HandleAppearCommand(), AuraEffect::HandleAuraAllowFlight(), AuraEffect::HandleAuraDummy(), AuraEffect::HandleAuraModIncreaseFlightSpeed(), misc_commandscript::HandleComeToMeCommand(), spell_q12589_shoot_rjr::HandleDummy(), spell_q11520_discovering_your_roots::HandleDummy(), spell_q6124_6129_apply_salve::HandleDummy(), spell_q11919_q11940_drake_hunt_aura::HandleEffectRemove(), spell_icc_geist_alarm::HandleEvent(), boss_sartharion_dragonAI::HandleExtraEvent(), go_commandscript::HandleGoGraveyardCommand(), go_commandscript::HandleGoGridCommand(), go_commandscript::HandleGoTicketCommand(), go_commandscript::HandleGoZoneXYCommand(), misc_commandscript::HandleGroupSummonCommand(), spell_chapter2_persuasive_strike::HandleHit(), boss_malygos::HandleIntroSpeech(), spell_item_toxic_wasteling::HandleJump(), AuraEffect::HandleModPossessPet(), misc_commandscript::HandleMovegensCommand(), WorldSession::HandleMoveTeleportAck(), WorldSession::HandleMoveWorldportAck(), npc_commandscript::HandleNpcFollowCommand(), npc_commandscript::HandleNpcMoveCommand(), npc_commandscript::HandleNpcSetMoveTypeCommand(), npc_commandscript::HandleNpcSetWanderDistanceCommand(), npc_commandscript::HandleNpcUnFollowCommand(), spell_item_enchanted_broom_periodic::HandlePeriodicTick(), WorldSession::HandlePetActionHelper(), WorldSession::HandlePlayerLoginFromDB(), spell_entropius_black_hole_effect::HandlePull(), spell_boss_magus_telestra_gravity_well::HandlePull(), PetAI::HandleReturnMovement(), spell_the_lich_king_valkyr_target_search::HandleScript(), spell_ayamiss_swarmer_teleport_trigger::HandleScript(), spell_gen_ayamiss_swarmer_loop::HandleScript(), WorldSession::HandleSetRaidDifficultyOpcode(), spell_sindragosa_icy_grip_jump::HandleSpecial(), npc_valkyr_shadowguard::npc_valkyr_shadowguardAI::HandleSpeedChangeIfNeeded(), spell_item_draenic_pale_ale::HandleSummon(), tele_commandscript::HandleTeleCommand(), tele_commandscript::HandleTeleGroupCommand(), wp_commandscript::HandleWpLoadCommand(), wp_commandscript::HandleWpUnLoadCommand(), boss_felmyst::InitializeAI(), boss_captain_skarloc::InitializeAI(), boss_lieutenant_drake::InitializeAI(), boss_glob_of_viscidus::InitializeAI(), npc_troll_volunteer::npc_troll_volunteerAI::InitializeAI(), boss_eck::InitializeAI(), npc_bushwhacker::npc_bushwhackerAI::InitializeAI(), boss_ambassador_hellmaw::InitializeAI(), npc_pet_dk_ebon_gargoyle::InitializeAI(), npc_pet_dk_dancing_rune_weapon::InitializeAI(), npc_pet_mage_mirror_image::InitializeAI(), Totem::InitSummon(), boss_grand_warlock_nethekurse::IntroRP(), Creature::IsFreeToMove(), IsMutualChase(), boss_gahzranka::IsSummonedBy(), boss_aeonus::IsSummonedBy(), npc_lk_spirit_bomb::npc_lk_spirit_bombAI::IsSummonedBy(), npc_burning_spirit::npc_burning_spiritAI::IsSummonedBy(), npc_demonic_vapor::IsSummonedBy(), npc_strangulate_vehicle::npc_strangulate_vehicleAI::IsSummonedBy(), npc_oculus_drake::npc_oculus_drakeAI::IsSummonedBy(), boss_kologarn_eyebeam::IsSummonedBy(), npc_wintergarde_gryphon::IsSummonedBy(), npc_frostbrood_skytalon::npc_frostbrood_skytalonAI::IsSummonedBy(), npc_pet_dk_ghoul::IsSummonedBy(), npc_spirit_shade::npc_spirit_shadeAI::IsSummonedBy(), Creature::IsUpdateNeeded(), JumpTo(), JumpTo(), boss_prince_keleseth_icc::boss_prince_kelesethAI::JustDied(), boss_prince_taldaram_icc::boss_prince_taldaramAI::JustDied(), boss_prince_valanar_icc::boss_prince_valanarAI::JustDied(), npc_enraged_spirit::npc_enraged_spiritAI::JustDied(), boss_ayamiss::JustDied(), boss_shade_of_aran::JustEngagedWith(), npc_cyclone::JustEngagedWith(), npc_sunblade_scout::JustEngagedWith(), boss_akilzon::JustEngagedWith(), npc_amanishi_scout::JustEngagedWith(), npc_zulian_prowler::npc_zulian_prowlerAI::JustEngagedWith(), boss_grandmaster_vorpil::JustEngagedWith(), boss_warlord_kalithresh::JustEngagedWith(), boss_swamplord_muselek::JustEngagedWith(), boss_nazan::JustEngagedWith(), boss_high_botanist_freywinn::JustEngagedWith(), boss_ayamiss::JustEngagedWith(), boss_felmyst::JustEngagedWith(), boss_janalai::JustEngagedWith(), boss_jeklik::JustEngagedWith(), boss_alar::JustEngagedWith(), boss_high_astromancer_solarian::JustEngagedWith(), SmartAI::JustReachedHome(), npc_akama_illidan::JustReachedHome(), boss_ghazan::JustReachedHome(), boss_grand_warlock_nethekurse::JustReachedHome(), npc_mature_netherwing_drake::npc_mature_netherwing_drakeAI::JustReachedHome(), npc_highlord_darion_mograine::npc_highlord_darion_mograineAI::JustSummoned(), boss_kelthuzad::boss_kelthuzadAI::JustSummoned(), boss_auriaya::JustSummoned(), npc_frosthound::JustSummoned(), npc_eris_hevenfire::npc_eris_hevenfireAI::JustSummoned(), npc_daphne_stilwell::npc_daphne_stilwellAI::JustSummoned(), boss_mekgineer_steamrigger::JustSummoned(), boss_ichoron::boss_ichoronAI::JustSummoned(), boss_xevozz::boss_xevozzAI::JustSummoned(), npc_hor_lich_king::npc_hor_lich_kingAI::JustSummoned(), npc_ulduar_storm_tempered_keeper::JustSummoned(), boss_ingvar_the_plunderer::JustSummoned(), boss_vexallus::JustSummoned(), npc_kalecgos_kj::JustSummoned(), boss_janalai::JustSummoned(), boss_captain_skarloc::JustSummoned(), npc_thrall_old_hillsbrad::npc_thrall_old_hillsbradAI::JustSummoned(), npc_medivh_bm::JustSummoned(), boss_hadronox::JustSummoned(), boss_sartharion::JustSummoned(), boss_novos::JustSummoned(), boss_the_lich_king::boss_the_lich_kingAI::JustSummoned(), boss_algalon_the_observer::JustSummoned(), npc_tirions_gambit_tirion::npc_tirions_gambit_tirionAI::JustSummoned(), npc_overlord_drakuru_betrayal::JustSummoned(), npc_akama_shade::JustSummoned(), npc_creature_generator_akama::JustSummoned(), boss_hydross_the_unstable::JustSummoned(), boss_lady_vashj::JustSummoned(), boss_mennu_the_betrayer::JustSummoned(), boss_kaelthas::JustSummoned(), boss_mechano_lord_capacitus::JustSummoned(), npc_rinji::npc_rinjiAI::JustSummoned(), npc_lady_sylvanas_windrunner::npc_lady_sylvanas_windrunnerAI::JustSummoned(), npc_maghar_captive::npc_maghar_captiveAI::JustSummoned(), boss_ayamiss::JustSummoned(), Player::KillPlayer(), KnockbackFrom(), spell_svalna_revive_champion::Land(), CreatureGroup::LeaderMoveTo(), Player::LeaveBattleground(), npc_crystalline_frayer::LeaveSeedPod(), Creature::Motion_Initialize(), CreatureAI::MoveBackwardsChecks(), CreatureAI::MoveCircleChecks(), FollowerAI::MoveInLineOfSight(), npc_escortAI::MoveInLineOfSight(), SmartAI::MoveInLineOfSight(), boss_nalorakk::MoveInLineOfSight(), npc_aged_dying_ancient_kodo::MoveInLineOfSight(), npc_icc_nerubar_broodkeeper::npc_icc_nerubar_broodkeeperAI::MoveInLineOfSight(), npc_shattered_hand_scout::MoveInLineOfSight(), PetAI::MovementInform(), boss_ebonroc::boss_ebonrocAI::MovementInform(), boss_nightbane::MovementInform(), npc_harrison_jones::MovementInform(), boss_bug_trio::MovementInform(), boss_blood_queen_lana_thel::boss_blood_queen_lana_thelAI::MovementInform(), boss_professor_putricide::boss_professor_putricideAI::MovementInform(), boss_four_horsemen::boss_four_horsemenAI::MovementInform(), boss_malygos::MovementInform(), boss_volkhan::MovementInform(), npc_enslaved_proto_drake::MovementInform(), npc_wild_wyrm::MovementInform(), npc_akama_illidan::MovementInform(), boss_lady_vashj::MovementInform(), boss_nazan::MovementInform(), npc_fel_guard_hound::npc_fel_guard_houndAI::MovementInform(), boss_felmyst::MovementInform(), boss_kaelthas::MovementInform(), boss_jedoga_shadowseeker::MovementInform(), boss_ghazan::MovementInform(), npc_escortAI::MovementInform(), SmartAI::MovepointReached(), npc_cameron::MoveTheChildren(), boss_four_horsemen::boss_four_horsemenAI::MoveToCorner(), npc_janalai_hatcher::MoveToNewWaypoint(), npc_concentrated_ball::npc_concentrated_ballAI::MoveToNextPoint(), npc_hor_leader_second::npc_hor_leader_secondAI::MoveToNextStopPoint(), boss_leotheras_the_blind::MoveToTargetIfOutOfRange(), npc_pet_dk_ebon_gargoyle::MySelectNextTarget(), NearTeleportTo(), npc_attracted_reef_bull::npc_attracted_reef_bullAI::npc_attracted_reef_bullAI(), npc_batrider::npc_batrider(), npc_collapsing_star::npc_collapsing_star(), npc_frost_sphere::npc_frost_sphereAI::npc_frost_sphereAI(), npc_omen::npc_omenAI::npc_omenAI(), npc_pos_after_first_boss::npc_pos_after_first_bossAI::npc_pos_after_first_bossAI(), npc_ulduar_saronite_vapors::npc_ulduar_saronite_vapors(), spell_halion_twilight_phasing_aura::OnApply(), instance_serpent_shrine::instance_serpentshrine_cavern_InstanceMapScript::OnCreatureCreate(), npc_hyjal_jaina::OnGossipSelect(), npc_ulduar_expedition_commander::OnGossipSelect(), npc_kernobee::OnQuestAccept(), npc_engineer_helice::OnQuestAccept(), spell_chapter5_light_of_dawn_aura::OnRemove(), spell_halion_twilight_phasing_aura::OnRemove(), spell_malygos_vortex_visual::OnRemove(), SplineHandler::operator()(), npc_vehicle_d16_propelled_delivery::npc_vehicle_d16_propelled_deliveryAI::PassengerBoarded(), npc_wild_wyrm::PassengerBoarded(), npc_oculus_drake::npc_oculus_drakeAI::PassengerBoarded(), npc_hover_disk::PassengerBoarded(), npc_preparations_for_war_vehicle::PassengerBoarded(), boss_nightbane::PathEndReached(), boss_anetheron::PathEndReached(), boss_rage_winterchill::PathEndReached(), npc_hyjal_ground_trash::PathEndReached(), npc_hyjal_frost_wyrm::PathEndReached(), boss_ambassador_hellmaw::PathEndReached(), npc_akama_illidan::PathEndReached(), boss_nefarian::PathEndReached(), npc_hyjal_gargoyle::PathEndReached(), PauseMovement(), SmartAI::PausePath(), PetSpellFail(), npc_oculus_unstable_sphere::npc_oculus_unstable_sphereAI::PickNewLocation(), NPCStaveQuestAI::PrepareForEncounter(), PretendToDie(), boss_alar::PretendToDie(), npc_jungle_punch_target::npc_jungle_punch_targetAI::proceedCwEvent(), SmartScript::ProcessAction(), propagateSpeedChange(), npc_lake_frog::npc_lake_frogAI::ReceiveEmote(), RemoveCharmedBy(), boss_the_beast::boss_thebeastAI::Reset(), boss_felblood_kaelthas::Reset(), npc_acherus_necromancer::npc_acherus_necromancerAI::Reset(), npc_gothik_the_harvester::npc_gothik_the_harvesterAI::Reset(), npc_valkyr_battle_maiden::npc_valkyr_battle_maidenAI::Reset(), boss_janalai::Reset(), npc_janalai_hatcher::Reset(), boss_arlokk::boss_arlokkAI::Reset(), npc_zulian_prowler::npc_zulian_prowlerAI::Reset(), npc_batrider::Reset(), npc_brew_bubble::Reset(), boss_archimonde::Reset(), boss_ayamiss::Reset(), boss_bug_trio::Reset(), boss_jedoga_shadowseeker::Reset(), boss_taldaram::Reset(), npc_kinetic_bomb::npc_kinetic_bombAI::Reset(), npc_crystalline_frayer::Reset(), npc_assembly_lightning::Reset(), boss_kologarn::Reset(), npc_xt002_scrapbot::Reset(), npc_xt002_boombot::Reset(), npc_injured_7th_legion_soldier::npc_injured_7th_legion_soldierAI::Reset(), npc_q24545_lich_king::npc_q24545_lich_kingAI::Reset(), npc_released_offspring_harkoa::npc_released_offspring_harkoaAI::Reset(), npc_voidtraveler::Reset(), boss_lady_vashj::Reset(), boss_leotheras_the_blind::Reset(), boss_magtheridon::Reset(), npc_infernal_attacker::npc_infernal_attackerAI::Reset(), npc_pet_gen_gnomish_flame_turret::Reset(), Creature::Respawn(), Creature::ResumeChasingVictim(), boss_high_botanist_freywinn::ResumeEncounter(), ResumeMovement(), SmartAI::ResumePath(), Resurrect(), SmartAI::ReturnToLastOOCPos(), npc_escortAI::ReturnToLastPoint(), boss_alar::ScheduleAbilities(), boss_illidan_stormrage::ScheduleAbilities(), boss_magtheridon::ScheduleCombatEvents(), npc_dream_fog::npc_dream_fogAI::ScheduleEvents(), boss_felmyst::ScheduleGroundAbilities(), boss_nightbane::ScheduleLand(), boss_loken::ScheduleTasks(), boss_laj::ScheduleTasks(), Map::ScriptsProcess(), npc_putricide_oozeAI::SelectNewTarget(), npc_icc_ice_sphere::npc_icc_ice_sphereAI::SelectNewTarget(), npc_anubarak_spike::npc_anubarak_spikeAI::SelectNewTarget(), WorldSession::SendDoFlight(), boss_sartharion::SendLavaWaves(), SetCharmedBy(), SmartAI::SetCombatMovement(), SetConfused(), SmartAI::SetCurrentRangeMode(), boss_grand_warlock_nethekurse::SetData(), npc_ulduar_expedition_engineer::SetData(), gunship_npc_AI::SetData(), npc_enslaved_proto_drake::SetData(), boss_the_beast::boss_thebeastAI::SetData(), npc_eastvale_peasent::SetData(), npc_ulduar_mimiron_rocket::SetData(), setDeathState(), Creature::setDeathState(), SetFeared(), SmartAI::SetFollow(), FollowerAI::SetFollowComplete(), FollowerAI::SetFollowPaused(), npc_scarlet_ghoul::npc_scarlet_ghoulAI::SetGUID(), SetInCombatState(), Player::SetMover(), SetSpeed(), npc_tirion_fordring_tft::npc_tirion_fordringAI::sGossipSelect(), npc_harrison_jones::sGossipSelect(), npc_akama_illidan::sGossipSelect(), npc_akama_shade::sGossipSelect(), boss_thorim::SpawnAnArenaNPC(), npc_varian_wrynn::npc_varian_wrynnAI::SpawnWave(), npc_high_overlord_saurfang_icc::npc_high_overlord_saurfangAI::SpellHit(), npc_muradin_bronzebeard_icc::npc_muradin_bronzebeard_iccAI::SpellHit(), npc_saurfang_event::npc_saurfang_eventAI::SpellHit(), npc_cult_fanatic::npc_cult_fanaticAI::SpellHit(), npc_cult_adherent::npc_cult_adherentAI::SpellHit(), npc_tirion_fordring_tft::npc_tirion_fordringAI::SpellHit(), boss_urom::boss_uromAI::SpellHit(), boss_attumen::SpellHit(), npc_rabid_thistle_bear::npc_rabid_thistle_bearAI::SpellHit(), npc_forest_frog::SpellHit(), npc_aged_dying_ancient_kodo::SpellHit(), npc_troll_volunteer::npc_troll_volunteerAI::SpellHit(), boss_razorscale::SpellHit(), npc_enslaved_netherwing_drake::SpellHit(), npc_injured_patient::npc_injured_patientAI::SpellHit(), boss_headless_horseman_head::SpellHit(), npc_attracted_reef_bull::npc_attracted_reef_bullAI::SpellHit(), npc_iron_watcher::npc_iron_watcherAI::SpellHit(), npc_wild_wyrm::SpellHit(), npc_vengeful_shade::npc_vengeful_shadeAI::SpellHitTarget(), boss_quartermaster_zigris::SpellHitTarget(), boss_volkhan::SpellHitTarget(), npc_nerubian_burrower::npc_nerubian_burrowerAI::SpellHitTarget(), boss_devourer_of_souls::boss_devourer_of_soulsAI::SpellHitTarget(), npc_chesspiece::SpellHitTarget(), npc_pet_gen_fetch_ball::SpellHitTarget(), npc_belnistrasz::npc_belnistraszAI::sQuestAccept(), npc_escortAI::Start(), instance_violet_hold::instance_violet_hold_InstanceMapScript::StartBossEncounter(), npc_koltira_deathweaver::npc_koltira_deathweaverAI::StartEvent(), FollowerAI::StartFollow(), boss_felmyst::StartIntro(), WaypointMovementGenerator< Creature >::StartMove(), npc_stillpine_capitive::npc_stillpine_capitiveAI::StartMoving(), SmartAI::StartPath(), SmartAI::StopFollow(), SmartAI::StopPath(), npc_bh_thalorien_dawnseeker::npc_bh_thalorien_dawnseekerAI::SummonedCreatureDespawn(), boss_drakkari_colossus::boss_drakkari_colossusAI::SummonedCreatureDespawn(), boss_vazruden_the_herald::SummonedCreatureDies(), boss_jedoga_shadowseeker::SummonedCreatureDies(), Spell::SummonGuardian(), npc_lord_illidan_stormrage::npc_lord_illidan_stormrageAI::SummonNextWave(), Player::TeleportTo(), CreatureAI::TriggerAlert(), Pet::Update(), Update(), SimpleCharmedAI::UpdateAI(), npc_escortAI::UpdateAI(), boss_gyth::boss_gythAI::UpdateAI(), boss_quartermaster_zigris::UpdateAI(), boss_rend_blackhand::boss_rend_blackhandAI::UpdateAI(), npc_rookery_hatcher::npc_rookery_hatcherAI::UpdateAI(), boss_victor_nefarius::boss_victor_nefariusAI::UpdateAI(), boss_majordomo::boss_majordomoAI::UpdateAI(), boss_mr_smite::boss_mr_smiteAI::UpdateAI(), npc_scarlet_ghoul::npc_scarlet_ghoulAI::UpdateAI(), npc_unworthy_initiate::npc_unworthy_initiateAI::UpdateAI(), npc_scarlet_courier::npc_scarlet_courierAI::UpdateAI(), npc_acherus_necromancer::npc_acherus_necromancerAI::UpdateAI(), npc_gothik_the_harvester::npc_gothik_the_harvesterAI::UpdateAI(), npc_highlord_darion_mograine::npc_highlord_darion_mograineAI::UpdateAI(), npc_valkyr_battle_maiden::npc_valkyr_battle_maidenAI::UpdateAI(), boss_kirtonos_the_herald::boss_kirtonos_the_heraldAI::UpdateAI(), npc_madrigosa::UpdateAI(), npc_cameron::UpdateAI(), npc_eastvale_peasent::UpdateAI(), npc_partygoer_pather::UpdateAI(), npc_bh_thalorien_dawnseeker::npc_bh_thalorien_dawnseekerAI::UpdateAI(), npc_grand_magister_rommath::npc_grand_magister_rommathAI::UpdateAI(), npc_highborne_lamenter::npc_highborne_lamenterAI::UpdateAI(), npc_thrall_bfu::npc_thrall_bfuAI::UpdateAI(), npc_akilzon_eagle::UpdateAI(), npc_forest_frog::UpdateAI(), boss_arlokk::boss_arlokkAI::UpdateAI(), boss_mandokir::boss_mandokirAI::UpdateAI(), npc_winterfin_playmate::UpdateAI(), npc_snowfall_glade_playmate::UpdateAI(), npc_the_biggest_tree::UpdateAI(), npc_high_oracle_soo_roo::UpdateAI(), npc_elder_kekek::UpdateAI(), npc_the_etymidian::UpdateAI(), npc_alexstraza_the_lifebinder::UpdateAI(), boss_headless_horseman::UpdateAI(), npc_arthas::npc_arthasAI::UpdateAI(), boss_lieutenant_drake::UpdateAI(), npc_thrall_old_hillsbrad::npc_thrall_old_hillsbradAI::UpdateAI(), boss_onyxia::UpdateAI(), npc_draenei_survivor::npc_draenei_survivorAI::UpdateAI(), npc_rabid_thistle_bear::npc_rabid_thistle_bearAI::UpdateAI(), npc_weegli_blastfuse::npc_weegli_blastfuseAI::UpdateAI(), boss_jedoga_shadowseeker::UpdateAI(), npc_twilight_volunteer::UpdateAI(), npc_taldaram_flamesphere::UpdateAI(), boss_hadronox::UpdateAI(), npc_xerestrasza::npc_xerestraszaAI::UpdateAI(), boss_saviana_ragefire::boss_saviana_ragefireAI::UpdateAI(), boss_grand_champion::boss_grand_championAI::UpdateAI(), npc_nerubian_burrower::npc_nerubian_burrowerAI::UpdateAI(), npc_anubarak_spike::npc_anubarak_spikeAI::UpdateAI(), boss_jormungarAI::UpdateAI(), boss_icehowl::boss_icehowlAI::UpdateAI(), npc_fos_corrupted_soul_fragment::npc_fos_corrupted_soul_fragmentAI::UpdateAI(), npc_hor_leader::npc_hor_leaderAI::UpdateAI(), npc_hor_lich_king::npc_hor_lich_kingAI::UpdateAI(), npc_hor_leader_second::npc_hor_leader_secondAI::UpdateAI(), boss_garfrost::boss_garfrostAI::UpdateAI(), boss_krick::boss_krickAI::UpdateAI(), npc_pos_leader::npc_pos_leaderAI::UpdateAI(), npc_pos_after_first_boss::npc_pos_after_first_bossAI::UpdateAI(), npc_pos_tyrannus_events::npc_pos_tyrannus_eventsAI::UpdateAI(), npc_pos_leader_second::npc_pos_leader_secondAI::UpdateAI(), boss_drakkari_colossus::boss_drakkari_colossusAI::UpdateAI(), npc_blood_queen_lana_thel::npc_blood_queen_lana_thelAI::UpdateAI(), npc_kinetic_bomb::npc_kinetic_bombAI::UpdateAI(), boss_blood_queen_lana_thel::boss_blood_queen_lana_thelAI::UpdateAI(), npc_high_overlord_saurfang_icc::npc_high_overlord_saurfangAI::UpdateAI(), npc_muradin_bronzebeard_icc::npc_muradin_bronzebeard_iccAI::UpdateAI(), npc_high_overlord_saurfang_igb::npc_high_overlord_saurfang_igbAI::UpdateAI(), npc_muradin_bronzebeard_igb::npc_muradin_bronzebeard_igbAI::UpdateAI(), boss_lord_marrowgar::UpdateAI(), boss_professor_putricide::boss_professor_putricideAI::UpdateAI(), boss_sindragosa::boss_sindragosaAI::UpdateAI(), npc_rimefang::npc_rimefangAI::UpdateAI(), boss_the_lich_king::boss_the_lich_kingAI::UpdateAI(), npc_tirion_fordring_tft::npc_tirion_fordringAI::UpdateAI(), npc_valkyr_shadowguard::npc_valkyr_shadowguardAI::UpdateAI(), npc_strangulate_vehicle::npc_strangulate_vehicleAI::UpdateAI(), npc_valithria_cloud::npc_valithria_cloudAI::UpdateAI(), npc_icc_vengeful_fleshreaper::npc_icc_vengeful_fleshreaperAI::UpdateAI(), boss_four_horsemen::boss_four_horsemenAI::UpdateAI(), boss_kelthuzad::boss_kelthuzadAI::UpdateAI(), boss_sapphiron::boss_sapphironAI::UpdateAI(), boss_malygos::UpdateAI(), npc_power_spark::UpdateAI(), npc_oculus_unstable_sphere::npc_oculus_unstable_sphereAI::UpdateAI(), boss_urom::boss_uromAI::UpdateAI(), npc_oculus_drakegiver::npc_oculus_drakegiverAI::UpdateAI(), npc_oculus_drake::npc_oculus_drakeAI::UpdateAI(), npc_spark_of_ionar::UpdateAI(), boss_algalon_the_observer::UpdateAI(), npc_brann_bronzebeard_algalon::UpdateAI(), boss_stormcaller_brundir::UpdateAI(), boss_flame_leviathan::UpdateAI(), npc_hodirs_fury::UpdateAI(), boss_flame_leviathan_safety_container::UpdateAI(), npc_mechanolift::UpdateAI(), boss_mimiron::UpdateAI(), npc_ulduar_aerial_command_unit::UpdateAI(), npc_ulduar_emergency_fire_bot::UpdateAI(), boss_razorscale::UpdateAI(), npc_ulduar_expedition_engineer::UpdateAI(), boss_yoggsaron_death_orb::UpdateAI(), boss_ingvar_the_plunderer::UpdateAI(), npc_vrykul_skeleton::UpdateAI(), boss_skadi_grauf::boss_skadi_graufAI::UpdateAI(), boss_svala::boss_svalaAI::UpdateAI(), boss_ymiron::boss_ymironAI::UpdateAI(), npc_preparations_for_war_vehicle::UpdateAI(), npc_shandy_dalaran::npc_shandy_dalaranAI::UpdateAI(), npc_minigob_manabonk::UpdateAI(), npc_conversing_with_the_depths_trigger::npc_conversing_with_the_depths_triggerAI::UpdateAI(), npc_wintergarde_gryphon::UpdateAI(), npc_q24545_lich_king::npc_q24545_lich_kingAI::UpdateAI(), npc_commander_eligor_dawnbringer::npc_commander_eligor_dawnbringerAI::UpdateAI(), npc_wounded_skirmisher::UpdateAI(), npc_venture_co_straggler::npc_venture_co_stragglerAI::UpdateAI(), npc_battle_at_valhalas::npc_battle_at_valhalasAI::UpdateAI(), npc_lord_arete::npc_lord_areteAI::UpdateAI(), npc_infra_green_bomber_generic::npc_infra_green_bomber_genericAI::UpdateAI(), npc_frostbrood_skytalon::npc_frostbrood_skytalonAI::UpdateAI(), npc_iron_watcher::npc_iron_watcherAI::UpdateAI(), npc_freed_protodrake::npc_freed_protodrakeAI::UpdateAI(), npc_crusade_recruit::npc_crusade_recruitAI::UpdateAI(), boss_omor_the_unscarred::UpdateAI(), npc_millhouse_manastorm::npc_millhouse_manastormAI::UpdateAI(), npc_nether_drake::npc_nether_drakeAI::UpdateAI(), npc_fel_guard_hound::npc_fel_guard_houndAI::UpdateAI(), npc_mature_netherwing_drake::npc_mature_netherwing_drakeAI::UpdateAI(), npc_dragonmaw_peon::npc_dragonmaw_peonAI::UpdateAI(), npc_pet_dk_ebon_gargoyle::UpdateAI(), npc_pet_gen_target_following_bomb::UpdateAI(), npc_pet_gen_wind_rider_cub::UpdateAI(), npc_pet_gen_plump_turkey::UpdateAI(), npc_pet_gen_toxic_wasteling::UpdateAI(), PetAI::UpdateAI(), FollowerAI::UpdateAI(), npc_batrider::UpdateAI(), npc_concentrated_ball::npc_concentrated_ballAI::UpdateAI(), npc_xt002_scrapbot::UpdateAI(), npc_xt002_boombot::UpdateAI(), Player::UpdateCharmedAI(), npc_tirions_gambit_tirion::npc_tirions_gambit_tirionAI::UpdateEscortAI(), npc_tooga::npc_toogaAI::UpdateFollowerAI(), npc_jenny::UpdateFollowerAI(), npc_emily::npc_emilyAI::WaypointReached(), and npc_ancestral_wolf::npc_ancestral_wolfAI::WaypointReached().

◆ GetMotionMaster() [2/2]

const MotionMaster * Unit::GetMotionMaster ( ) const
inline
1743{ return i_motionMaster; }

References i_motionMaster.

◆ GetMountID()

◆ GetNativeDisplayId()

◆ GetNativeObjectScale()

virtual float Unit::GetNativeObjectScale ( ) const
inlinevirtual

Reimplemented in Creature, and Pet.

1955{ return 1.0f; }

Referenced by RecalculateObjectScale().

◆ GetNegStat()

float Unit::GetNegStat ( Stats  stat) const
inline
1056{ return GetFloatValue(static_cast<uint16>(UNIT_FIELD_NEGSTAT0) + stat); }

References Object::GetFloatValue(), and UNIT_FIELD_NEGSTAT0.

◆ GetNextRandomRaidMemberOrPet()

Unit * Unit::GetNextRandomRaidMemberOrPet ( float  radius)
8110{
8111 Player* player = nullptr;
8112 if (IsPlayer())
8113 player = ToPlayer();
8114 // Should we enable this also for charmed units?
8115 else if (IsCreature() && IsPet())
8116 player = GetOwner()->ToPlayer();
8117
8118 if (!player)
8119 return nullptr;
8120 Group* group = player->GetGroup();
8121 // When there is no group check pet presence
8122 if (!group)
8123 {
8124 // We are pet now, return owner
8125 if (player != this)
8126 return IsWithinDistInMap(player, radius) ? player : nullptr;
8127 Unit* pet = GetGuardianPet();
8128 // No pet, no group, nothing to return
8129 if (!pet)
8130 return nullptr;
8131 // We are owner now, return pet
8132 return IsWithinDistInMap(pet, radius) ? pet : nullptr;
8133 }
8134
8135 std::vector<Unit*> nearMembers;
8136 // reserve place for players and pets because resizing vector every unit push is unefficient (vector is reallocated then)
8137 nearMembers.reserve(group->GetMembersCount() * 2);
8138
8139 for (GroupReference* itr = group->GetFirstMember(); itr != nullptr; itr = itr->next())
8140 if (Player* Target = itr->GetSource())
8141 {
8142 if (Target != this && !IsWithinDistInMap(Target, radius))
8143 continue;
8144
8145 // IsHostileTo check duel and controlled by enemy
8146 if (Target != this && Target->IsAlive() && !IsHostileTo(Target))
8147 nearMembers.push_back(Target);
8148
8149 // Push player's pet to vector
8150 if (Unit* pet = Target->GetGuardianPet())
8151 if (pet != this && pet->IsAlive() && IsWithinDistInMap(pet, radius) && !IsHostileTo(pet))
8152 nearMembers.push_back(pet);
8153 }
8154
8155 if (nearMembers.empty())
8156 return nullptr;
8157
8158 uint32 randTarget = urand(0, nearMembers.size() - 1);
8159 return nearMembers[randTarget];
8160}
Definition GroupReference.h:27
Definition Group.h:169
uint32 GetMembersCount() const
Definition Group.h:245
GroupReference * GetFirstMember()
Definition Group.h:243
Group * GetGroup()
Definition Player.h:2501
Guardian * GetGuardianPet() const
Definition Unit.cpp:7640
bool IsWithinDistInMap(WorldObject const *obj, float dist2compare, bool is3D=true, bool incOwnRadius=true, bool incTargetRadius=true) const
Definition Object.cpp:1347

References Group::GetFirstMember(), Player::GetGroup(), GetGuardianPet(), Group::GetMembersCount(), GetOwner(), Object::IsCreature(), IsHostileTo(), IsPet(), Object::IsPlayer(), WorldObject::IsWithinDistInMap(), Object::ToPlayer(), and urand().

Referenced by HandleAuraRaidProcFromCharge(), and AuraEffect::HandleRaidProcFromChargeAuraProc().

◆ GetNpcFlags()

◆ GetOldFactionId()

uint32 Unit::GetOldFactionId ( ) const
inline
849{ return _oldFactionId; }

References _oldFactionId.

Referenced by npc_chesspiece::OnCharmed().

◆ GetOwnedAura()

Aura * Unit::GetOwnedAura ( uint32  spellId,
ObjectGuid  casterGUID = ObjectGuid::Empty,
ObjectGuid  itemCasterGUID = ObjectGuid::Empty,
uint8  reqEffMask = 0,
Aura except = nullptr 
) const
4979{
4980 AuraMapBounds range = m_ownedAuras.equal_range(spellId);
4981 for (AuraMap::const_iterator itr = range.first; itr != range.second; ++itr)
4982 {
4983 if (((itr->second->GetEffectMask() & reqEffMask) == reqEffMask)
4984 && (!casterGUID || itr->second->GetCasterGUID() == casterGUID)
4985 && (!itemCasterGUID || itr->second->GetCastItemGUID() == itemCasterGUID)
4986 && (!except || except != itr->second))
4987 {
4988 return itr->second;
4989 }
4990 }
4991 return nullptr;
4992}
std::pair< AuraMap::const_iterator, AuraMap::const_iterator > AuraMapBounds
Definition Unit.h:664

References m_ownedAuras.

Referenced by _TryStackingOrRefreshingExistingAura().

◆ GetOwnedAuras() [1/2]

◆ GetOwnedAuras() [2/2]

AuraMap const & Unit::GetOwnedAuras ( ) const
inline
1363{ return m_ownedAuras; }

References m_ownedAuras.

◆ GetOwner()

Unit * Unit::GetOwner ( ) const
Todo:
: move this in Object class or move GetUInt32value here but keep consistency
7590{
7591 if (ObjectGuid ownerGUID = GetOwnerGUID())
7592 return ObjectAccessor::GetUnit(*this, ownerGUID);
7593
7594 return nullptr;
7595}

References GetOwnerGUID(), and ObjectAccessor::GetUnit().

Referenced by _ExitVehicle(), Acore::AnyAoETargetUnitInObjectRangeCheck::AnyAoETargetUnitInObjectRangeCheck(), ApplyDiminishingToDuration(), ApplyResilience(), TotemAI::AttackStart(), spell_dk_anti_magic_zone::CalculateAmount(), spell_warl_generic_scaling::CalculateAPAmount(), Creature::CanStartAttack(), spell_dk_blood_gorged::CheckProc(), spell_pri_mana_leech::CheckProc(), ClearInPetCombat(), CombatStart(), CombatStartOnCast(), DealHeal(), HostileRefMgr::deleteReferences(), npc_spring_rabbit::npc_spring_rabbitAI::DoAction(), Spell::DoAllEffectOnLaunchTarget(), Spell::DoAllEffectOnTarget(), PetAI::DoAttack(), Spell::EffectDispel(), Spell::EffectSchoolDMG(), Spell::EffectWeaponDmg(), boss_illidari_council_memberAI::EnterEvadeMode(), GetCharmerOrOwner(), GetCombatRatingReduction(), GetNextRandomRaidMemberOrPet(), GetReactionTo(), GetSpellModOwner(), spell_warl_seduction::HandleAuraApply(), HandleAuraRaidProcFromChargeWithValue(), Aura::HandleAuraSpecificMods(), spell_sha_healing_stream_totem::HandleDummy(), spell_q12277_wintergarde_mine_explosion::HandleDummy(), spell_sha_mana_tide_totem::HandleDummy(), spell_mount_check_aura::HandleEffectPeriodic(), spell_gen_gryphon_wyvern_mount_check::HandleEffectPeriodic(), spell_ioc_bomb_blast_criteria::HandleGameObjectDamage(), modify_commandscript::HandleModifyTalentCommand(), WorldSession::HandlePetActionHelper(), spell_hun_kill_command_pet::HandleProc(), spell_warl_demonic_pact::HandleProc(), spell_sha_spirit_hunt::HandleProc(), spell_warl_demonic_pact_aura::HandleProc(), spell_hun_pet_heart_of_the_phoenix::HandleScript(), npc_troll_volunteer::npc_troll_volunteerAI::InitializeAI(), npc_pet_dk_ebon_gargoyle::InitializeAI(), npc_pet_dk_dancing_rune_weapon::InitializeAI(), npc_pet_mage_mirror_image::InitializeAI(), IsAlwaysVisibleFor(), IsPetAura(), npc_enraged_spirit::npc_enraged_spiritAI::JustDied(), npc_webbed_creature::npc_webbed_creatureAI::JustDied(), npc_torloth_the_magnificent::npc_torloth_the_magnificentAI::JustDied(), Kill(), MagicSpellHitResult(), MeleeDamageBonusDone(), npc_dkc1_gothik::npc_dkc1_gothikAI::MoveInLineOfSight(), npc_khunok_the_behemoth::npc_khunok_the_behemothAI::MoveInLineOfSight(), npc_pet_dk_ebon_gargoyle::MySelectNextTarget(), npc_pet_mage_mirror_image::MySelectNextTarget(), npc_ancestral_wolf::npc_ancestral_wolfAI::npc_ancestral_wolfAI(), npc_pet_gen_soul_trader_beacon::npc_pet_gen_soul_trader_beacon(), instance_icecrown_citadel::instance_icecrown_citadel_InstanceMapScript::OnCreatureCreate(), spell_hun_aspect_of_the_beast::OnPetApply(), Acore::MostHPMissingGroupInRange::operator()(), PetSpellFail(), RemoveFromWorld(), npc_target_dummy::npc_target_dummyAI::Reset(), npc_spring_rabbit::npc_spring_rabbitAI::Reset(), RestoreFaction(), Creature::SelectVictim(), SendPetActionFeedback(), SendPetAIReaction(), SetHealth(), SetMaxHealth(), SetMaxPower(), SetPower(), setPowerType(), SetStunned(), SpellDamageBonusDone(), SpellHealingBonusDone(), npc_rabid_thistle_bear::npc_rabid_thistle_bearAI::SpellHit(), SpellPctDamageModsDone(), SpellPctHealingModsDone(), npc_scarlet_courier::npc_scarlet_courierAI::UpdateAI(), npc_pet_gen_wind_rider_cub::UpdateAI(), npc_pet_hunter_snake_trap::UpdateAI(), npc_target_dummy::npc_target_dummyAI::UpdateAI(), and UpdateAuraForGroup().

◆ GetOwnerGUID()

ObjectGuid Unit::GetOwnerGUID ( ) const
inline
@ UNIT_FIELD_SUMMONEDBY
Definition UpdateFields.h:90

References Object::GetGuidValue(), and UNIT_FIELD_SUMMONEDBY.

Referenced by Pet::AddToWorld(), npc_living_mojo::npc_living_mojoAI::AttackStart(), BuildValuesUpdate(), PetAI::CanAttack(), CanFreeMove(), CanHaveThreatList(), boss_thorim_start_npcs::DamageTaken(), DealDamage(), Spell::DoAllEffectOnTarget(), FollowMovementGenerator< T >::DoUpdate(), GetCharmerOrOwnerGUID(), GetOwner(), AuraEffect::HandleModInvisibility(), AuraEffect::HandleModInvisibilityDetect(), AuraEffect::HandleModStealth(), AuraEffect::HandleModStealthDetect(), AuraEffect::HandleModStealthLevel(), WorldSession::HandlePetActionHelper(), WorldSession::HandlePetRename(), HandleSpellClick(), Creature::HasMechanicTemplateImmunity(), Creature::IsDungeonBoss(), Creature::IsImmuneToKnockback(), isInAccessiblePlaceFor(), Kill(), Creature::LoadSpellTemplateImmunity(), Condition::Meets(), instance_icecrown_citadel::instance_icecrown_citadel_InstanceMapScript::OnCreatureCreate(), npc_pet_gen_argent_pony_bridle::OnGossipHello(), npc_venomhide_hatchling::OnGossipHello(), Acore::MostHPMissingGroupInRange::operator()(), PlayerOrPetCheck::operator()(), OutDebugInfo(), PetAI::ReceiveEmote(), Creature::Regenerate(), RemoveAllControlled(), RemoveEvadeAuras(), Pet::SavePetToDB(), spell_item_fetch_ball::SelectTarget(), SetMinion(), SetOwnerGUID(), SpellPctDamageModsDone(), Map::SummonCreature(), NPCStaveQuestAI::UnitIsUnfair(), Creature::Update(), and npc_pet_dk_ebon_gargoyle::UpdateAI().

◆ GetPartyMembers()

void Unit::GetPartyMembers ( std::list< Unit * > &  units)
15186{
15187 Unit* owner = GetCharmerOrOwnerOrSelf();
15188 Group* group = nullptr;
15189 if (owner->IsPlayer())
15190 group = owner->ToPlayer()->GetGroup();
15191
15192 if (group)
15193 {
15194 uint8 subgroup = owner->ToPlayer()->GetSubGroup();
15195
15196 for (GroupReference* itr = group->GetFirstMember(); itr != nullptr; itr = itr->next())
15197 {
15198 Player* Target = itr->GetSource();
15199
15200 // IsHostileTo check duel and controlled by enemy
15201 if (Target && Target->IsInMap(owner) && Target->GetSubGroup() == subgroup && !IsHostileTo(Target))
15202 {
15203 if (Target->IsAlive())
15204 TagUnitMap.push_back(Target);
15205
15206 for (Unit::ControlSet::iterator iterator = Target->m_Controlled.begin(); iterator != Target->m_Controlled.end(); ++iterator)
15207 {
15208 if (Unit* pet = *iterator)
15209 if (pet->IsGuardian() && pet->IsAlive())
15210 TagUnitMap.push_back(pet);
15211 }
15212 }
15213 }
15214 }
15215 else
15216 {
15217 if (owner->IsAlive())
15218 TagUnitMap.push_back(owner);
15219
15220 for (Unit::ControlSet::iterator itr = owner->m_Controlled.begin(); itr != owner->m_Controlled.end(); ++itr)
15221 {
15222 if (Unit* pet = *itr)
15223 if (pet->IsGuardian() && pet->IsAlive())
15224 TagUnitMap.push_back(pet);
15225 }
15226 }
15227}
uint8 GetSubGroup() const
Definition Player.h:2505

References GetCharmerOrOwnerOrSelf(), Group::GetFirstMember(), Player::GetGroup(), Player::GetSubGroup(), IsAlive(), IsHostileTo(), WorldObject::IsInMap(), Object::IsPlayer(), m_Controlled, and Object::ToPlayer().

Referenced by spell_warr_improved_spell_reflection_trigger_aura::HandleRemove().

◆ GetPctModifierValue()

◆ GetPetGUID()

◆ GetPhaseByAuras()

uint32 Unit::GetPhaseByAuras ( ) const
15405{
15406 uint32 currentPhase = 0;
15408 if (!phases.empty())
15409 for (AuraEffectList::const_iterator itr = phases.begin(); itr != phases.end(); ++itr)
15410 currentPhase |= (*itr)->GetMiscValue();
15411
15412 return currentPhase;
15413}
@ SPELL_AURA_PHASE
Definition SpellAuraDefines.h:324

References GetAuraEffectsByType(), and SPELL_AURA_PHASE.

Referenced by Player::GetPhaseMaskForSpawn(), AuraEffect::HandlePhase(), and Player::SetGameMaster().

◆ GetPosStat()

float Unit::GetPosStat ( Stats  stat) const
inline
1055{ return GetFloatValue(static_cast<uint16>(UNIT_FIELD_POSSTAT0) + stat); }

References Object::GetFloatValue(), and UNIT_FIELD_POSSTAT0.

◆ GetPower()

uint32 Unit::GetPower ( Powers  power) const
inline
1124{ return GetUInt32Value(static_cast<uint16>(UNIT_FIELD_POWER1) + power); }
@ UNIT_FIELD_POWER1
Definition UpdateFields.h:97

References Object::GetUInt32Value(), and UNIT_FIELD_POWER1.

Referenced by PetAI::_canMeleeAttack(), Player::_SaveCharacter(), WorldSession::BuildPartyMemberStatsChangedPacket(), SpellInfo::CalcPowerCost(), spell_igb_cannon_blast::CalculatePower(), Creature::CanCastSpell(), Spell::CheckItems(), Spell::CheckPower(), boss_lady_deathwhisper::boss_lady_deathwhisperAI::DamageTaken(), Spell::EffectCastButtons(), Spell::EffectWeaponDmg(), Pet::FillPetInfo(), Pet::GetHappinessState(), GetPowerPct(), Player::GiveLevel(), AuraEffect::HandleAuraModShapeshift(), spell_warr_execute::HandleEffect(), AuraEffect::HandleObsModPowerAuraTick(), spell_dk_pet_scaling::HandlePeriodic(), spell_dru_frenzied_regeneration::HandlePeriodic(), spell_hun_generic_scaling::HandlePeriodic(), spell_mage_pet_scaling::HandlePeriodic(), spell_sha_feral_spirit_scaling::HandlePeriodic(), spell_warl_generic_scaling::HandlePeriodic(), AuraEffect::HandlePeriodicEnergizeAuraTick(), AuraEffect::HandlePeriodicTriggerSpellAuraTick(), WorldSession::HandlePetAbandon(), WorldSession::HandleRequestPartyMemberStatsOpcode(), ArenaSpectator::HandleResetCommand(), spell_pal_lay_on_hands::HandleScript(), Player::InitStatsForLevel(), boss_shade_of_aran::JustEngagedWith(), npc_obsidian_destroyer::JustEngagedWith(), spell_gen_replenishment_aura::Load(), Pet::LoseHappiness(), ModifyPower(), spell_mark_of_kazrogal_aura::OnPeriodic(), spell_mark_of_kazzak_aura::OnPeriodic(), Acore::PowerPctOrderPred::operator()(), Acore::PowerPctOrderPred::operator()(), SmartScript::ProcessAction(), Creature::reachWithSpellAttack(), Creature::reachWithSpellCure(), Creature::Regenerate(), Player::Regenerate(), Creature::RegenerateHealth(), Player::SaveManaBeforeDuel(), Pet::SavePetToDB(), Creature::SaveToDB(), ScriptedAI::SelectSpell(), Spell::SendSpellGo(), Spell::SendSpellStart(), SetMaxPower(), SetPower(), setPowerType(), spell_igb_incinerating_blast::StoreEnergy(), Aura::Update(), boss_moam::UpdateAI(), boss_thorim_start_npcs::UpdateAI(), boss_thorim_gauntlet_npcs::UpdateAI(), boss_thorim_arena_npcs::UpdateAI(), PetAI::UpdateAI(), and Player::UpdateCharmedAI().

◆ GetPowerPct()

float Unit::GetPowerPct ( Powers  power) const
inline
1126{ return GetMaxPower(power) ? 100.f * GetPower(power) / GetMaxPower(power) : 0.0f; }
uint32 GetMaxPower(Powers power) const
Definition Unit.h:1125
uint32 GetPower(Powers power) const
Definition Unit.h:1124

References GetMaxPower(), and GetPower().

Referenced by npc_obsidian_destroyer::JustEngagedWith(), npc_obsidian_eradicator::JustEngagedWith(), npc_obsidian_nullifier::JustEngagedWith(), boss_curator::JustEngagedWith(), SmartScript::ProcessAction(), SmartScript::ProcessEvent(), and boss_hazzarah::UpdateAI().

◆ getPowerType()

Powers Unit::getPowerType ( ) const
inline
1120{ return Powers(GetByteValue(UNIT_FIELD_BYTES_0, 3)); }
Powers
Definition SharedDefines.h:279

References Object::GetByteValue(), and UNIT_FIELD_BYTES_0.

Referenced by boss_marli::_chargePlayer(), Player::ActivateSpec(), WorldSession::BuildPartyMemberStatsChangedPacket(), Creature::CanCastSpell(), spell_pal_judgement_of_wisdom_mana::CheckProc(), Spell::EffectSummonPet(), spell_chain_burn::FilterTargets(), spell_moam_mana_drain_filter::FilterTargets(), AuraEffect::HandleAuraModShapeshift(), Aura::HandleAuraSpecificMods(), AuraEffect::HandleObsModPowerAuraTick(), spell_dru_frenzied_regeneration::HandlePeriodic(), spell_dru_revitalize::HandleProc(), spell_dru_t3_2p_bonus::HandleProc(), spell_item_heartpierce::HandleProc(), spell_item_heartpierce_hero::HandleProc(), WorldSession::HandleRequestPartyMemberStatsOpcode(), ArenaSpectator::HandleResetCommand(), HasActivePowerType(), Player::HasActivePowerType(), Player::InitDataForForm(), ManaVoidSelector::operator()(), LeechingThrowSelector::operator()(), PowerUsersSelector::operator()(), spell_item_oracle_ablutions::PrepareSpellScript(), spell_item_mad_alchemists_potion::SecondaryEffect(), spell_item_crazy_alchemists_potion::SecondaryEffect(), boss_faction_championsAI::SelectEnemyCaster(), setDeathState(), SetMaxPower(), SetPower(), Pet::Update(), Creature::Update(), boss_vaelastrasz::boss_vaelAI::UpdateAI(), boss_ragnaros::boss_ragnarosAI::UpdateAI(), boss_hazzarah::UpdateAI(), boss_faction_championsAI::UpdateAI(), npc_nether_drake::npc_nether_drakeAI::UpdateAI(), and lfg::LFGMgr::UpdateRaidBrowser().

◆ GetPowerTypeByAuraGroup()

Powers Unit::GetPowerTypeByAuraGroup ( UnitMods  unitMod) const
12417{
12418 switch (unitMod)
12419 {
12420 case UNIT_MOD_RAGE:
12421 return POWER_RAGE;
12422 case UNIT_MOD_FOCUS:
12423 return POWER_FOCUS;
12424 case UNIT_MOD_ENERGY:
12425 return POWER_ENERGY;
12426 case UNIT_MOD_HAPPINESS:
12427 return POWER_HAPPINESS;
12428 case UNIT_MOD_RUNE:
12429 return POWER_RUNE;
12431 return POWER_RUNIC_POWER;
12432 default:
12433 case UNIT_MOD_MANA:
12434 return POWER_MANA;
12435 }
12436}
@ UNIT_MOD_RUNE
Definition Unit.h:161
@ UNIT_MOD_ENERGY
Definition Unit.h:159
@ UNIT_MOD_FOCUS
Definition Unit.h:158
@ UNIT_MOD_HAPPINESS
Definition Unit.h:160
@ UNIT_MOD_MANA
Definition Unit.h:156
@ UNIT_MOD_RAGE
Definition Unit.h:157
@ UNIT_MOD_RUNIC_POWER
Definition Unit.h:162

References POWER_ENERGY, POWER_FOCUS, POWER_HAPPINESS, POWER_MANA, POWER_RAGE, POWER_RUNE, POWER_RUNIC_POWER, UNIT_MOD_ENERGY, UNIT_MOD_FOCUS, UNIT_MOD_HAPPINESS, UNIT_MOD_MANA, UNIT_MOD_RAGE, UNIT_MOD_RUNE, and UNIT_MOD_RUNIC_POWER.

Referenced by UpdateUnitMod().

◆ GetPPMProcChance()

float Unit::GetPPMProcChance ( uint32  WeaponSpeed,
float  PPM,
SpellInfo const *  spellProto 
) const
10376{
10377 // proc per minute chance calculation
10378 if (PPM <= 0)
10379 return 0.0f;
10380
10381 // Apply chance modifer aura
10382 if (spellProto)
10383 if (Player* modOwner = GetSpellModOwner())
10384 modOwner->ApplySpellMod(spellProto->Id, SPELLMOD_PROC_PER_MINUTE, PPM);
10385
10386 return (WeaponSpeed * PPM) / 600.0f; // result is chance in percents (probability = Speed_in_sec * (PPM / 60))
10387}
@ SPELLMOD_PROC_PER_MINUTE
Definition SpellDefines.h:102

References GetSpellModOwner(), SpellInfo::Id, and SPELLMOD_PROC_PER_MINUTE.

Referenced by Player::CastItemCombatSpell().

◆ GetProcAurasTriggeredOnEvent()

void Unit::GetProcAurasTriggeredOnEvent ( AuraApplicationProcContainer aurasTriggeringProc,
std::list< AuraApplication * > *  procAuras,
ProcEventInfo  eventInfo 
)
12994{
12995 TimePoint now = std::chrono::steady_clock::now();
12996
12997 auto processAuraApplication = [&](AuraApplication* aurApp)
12998 {
12999 if (uint8 procEffectMask = aurApp->GetBase()->GetProcEffectMask(aurApp, eventInfo, now))
13000 {
13001 aurApp->GetBase()->PrepareProcToTrigger(aurApp, eventInfo, now);
13002 aurasTriggeringProc.emplace_back(procEffectMask, aurApp);
13003 }
13004 else
13005 {
13006 if (aurApp->GetBase()->GetSpellInfo()->HasAttribute(SPELL_ATTR2_PROC_COOLDOWN_ON_FAILURE))
13007 if (SpellProcEntry const* procEntry = sSpellMgr->GetSpellProcEntry(aurApp->GetBase()->GetId()))
13008 aurApp->GetBase()->AddProcCooldown(procEntry, now);
13009 }
13010 };
13011
13012 // use provided list of auras which can proc
13013 if (procAuras)
13014 {
13015 for (std::list<AuraApplication*>::iterator itr = procAuras->begin(); itr != procAuras->end(); ++itr)
13016 {
13017 ASSERT((*itr)->GetTarget() == this);
13018 if (!(*itr)->GetRemoveMode())
13019 processAuraApplication(*itr);
13020 }
13021 }
13022 // or generate one on our own
13023 else
13024 {
13025 for (AuraApplicationMap::iterator itr = GetAppliedAuras().begin(); itr != GetAppliedAuras().end(); ++itr)
13026 processAuraApplication(itr->second);
13027 }
13028}
std::chrono::steady_clock::time_point TimePoint
time_point shorthand typedefs
Definition Duration.h:69
@ SPELL_ATTR2_PROC_COOLDOWN_ON_FAILURE
Definition SharedDefines.h:490
Definition SpellMgr.h:283

References ASSERT, GetAppliedAuras(), SPELL_ATTR2_PROC_COOLDOWN_ON_FAILURE, and sSpellMgr.

Referenced by TriggerAurasProcOnEvent().

◆ getRace()

uint8 Unit::getRace ( bool  original = false) const
17218{
17219 if (IsPlayer())
17220 {
17221 if (original)
17222 return m_realRace;
17223 else
17224 return m_race;
17225 }
17226
17228}

References Object::GetByteValue(), Object::IsPlayer(), m_race, m_realRace, and UNIT_FIELD_BYTES_0.

Referenced by Player::_LoadHomeBind(), Player::_LoadSkills(), Player::_SaveCharacter(), Player::BuildPlayerRepop(), Corpse::BuildValuesUpdate(), Player::CheckSkillLearnedBySpell(), Player::CreateCorpse(), GetModelForForm(), ObjectMgr::GetModelForShapeshift(), getRaceMask(), GetReactionTo(), Player::GetStartPosition(), Player::GetTeamId(), Player::GiveLevel(), WorldSession::HandleAlterAppearance(), AuraEffect::HandleAuraTransform(), WorldSession::HandleMirrorImageDataRequest(), modify_commandscript::HandleModifyGenderCommand(), misc_commandscript::HandlePInfoCommand(), WorldSession::HandlePlayerLoginFromDB(), reset_commandscript::HandleResetStatsOrLevelHelper(), Player::InitDisplayIds(), Player::InitStatsForLevel(), Guardian::InitStatsForLevel(), Player::InitTaxiNodesForLevel(), Player::IsSpellFitByClassAndRace(), Trainer::Trainer::IsTrainerValidForPlayer(), Channel::KickOrBan(), Player::LearnCustomSpells(), Player::LearnDefaultSkill(), Player::LearnDefaultSkills(), Player::LoadFromDB(), AchievementCriteriaData::Meets(), instance_culling_of_stratholme::instance_culling_of_stratholme_InstanceMapScript::OnPlayerEnter(), InstanceScript::OnPlayerLeave(), RestoreFaction(), Player::RewardHonor(), WorldSession::SendNameQueryOpcode(), Player::SetGameMaster(), Player::StoreNewItemInBestSlots(), lfg::LFGMgr::UpdateRaidBrowser(), and Player::UpdateSkillsForLevel().

◆ getRaceMask()

◆ GetRandomContactPoint()

bool Unit::GetRandomContactPoint ( Unit const *  target,
float &  x,
float &  y,
float &  z,
bool  force = false 
) const
823{
824 float combat_reach = GetCombatReach();
825 if (combat_reach < 0.1f) // sometimes bugged for players
826 combat_reach = DEFAULT_COMBAT_REACH;
827
828 uint32 attacker_number = getAttackers().size();
829 if (attacker_number > 0)
830 --attacker_number;
831 Creature const* c = obj->ToCreature();
832 if (c)
833 if (c->isWorldBoss() || c->IsDungeonBoss() || (obj->IsPet() && const_cast<Unit*>(obj)->ToPet()->isControlled()))
834 attacker_number = 0; // pussywizard: pets and bosses just come to target from their angle
835
836 GetNearPoint(obj, x, y, z, isMoving() ? (obj->GetCombatReach() > 7.75f ? obj->GetCombatReach() - 7.5f : 0.25f) : obj->GetCombatReach(), 0.0f,
837 GetAngle(obj) + (attacker_number ? (static_cast<float>(M_PI / 2) - static_cast<float>(M_PI) * (float)rand_norm()) * float(attacker_number) / combat_reach * 0.3f : 0));
838
839 // pussywizard
840 if (std::fabs(this->GetPositionZ() - z) > this->GetCollisionHeight() || !IsWithinLOS(x, y, z))
841 {
842 x = this->GetPositionX();
843 y = this->GetPositionY();
844 z = this->GetPositionZ();
845 obj->UpdateAllowedPositionZ(x, y, z);
846 }
847 float maxDist = GetMeleeRange(obj);
848 if (GetExactDistSq(x, y, z) >= maxDist * maxDist)
849 {
850 if (force)
851 {
852 x = this->GetPositionX();
853 y = this->GetPositionY();
854 z = this->GetPositionZ();
855 return true;
856 }
857 return false;
858 }
859 return true;
860}
#define DEFAULT_COMBAT_REACH
Definition ObjectDefines.h:45
bool IsDungeonBoss() const
Definition Creature.cpp:3123
bool isControlled() const
Definition Pet.h:54
float GetCollisionHeight() const override
Return collision height sent to client.
Definition Unit.cpp:17317
float GetMeleeRange(Unit const *target) const
Definition Unit.cpp:791
bool IsWithinLOS(float x, float y, float z, VMAP::ModelIgnoreFlags ignoreFlags=VMAP::ModelIgnoreFlags::Nothing, LineOfSightChecks checks=LINEOFSIGHT_ALL_CHECKS) const
Definition Object.cpp:1352
float GetExactDistSq(float x, float y, float z) const
Definition Position.h:174

References DEFAULT_COMBAT_REACH, Position::GetAngle(), getAttackers(), GetCollisionHeight(), GetCombatReach(), Position::GetExactDistSq(), GetMeleeRange(), WorldObject::GetNearPoint(), Position::GetPositionX(), Position::GetPositionY(), Position::GetPositionZ(), Pet::isControlled(), Creature::IsDungeonBoss(), isMoving(), IsPet(), WorldObject::IsWithinLOS(), Creature::isWorldBoss(), rand_norm(), Object::ToCreature(), ToPet(), and WorldObject::UpdateAllowedPositionZ().

Referenced by boss_bug_trio::DamageTaken(), and boss_bug_trio::DoFinalSpell().

◆ GetRangedCritChanceReduction()

float Unit::GetRangedCritChanceReduction ( ) const
inline

◆ GetRangedCritDamageReduction()

uint32 Unit::GetRangedCritDamageReduction ( uint32  damage) const
inline

◆ GetRangedDamageReduction()

uint32 Unit::GetRangedDamageReduction ( uint32  damage) const
inline

◆ GetReactionTo()

ReputationRank Unit::GetReactionTo ( Unit const *  target,
bool  checkOriginalFaction = false 
) const
7029{
7030 // always friendly to self
7031 if (this == target)
7032 return REP_FRIENDLY;
7033
7034 // always friendly to charmer or owner
7036 return REP_FRIENDLY;
7037
7038 Player const* selfPlayerOwner = GetAffectingPlayer();
7039 Player const* targetPlayerOwner = target->GetAffectingPlayer();
7040
7041 // check forced reputation to support SPELL_AURA_FORCE_REACTION
7042 if (selfPlayerOwner)
7043 {
7044 if (FactionTemplateEntry const* targetFactionTemplateEntry = target->GetFactionTemplateEntry())
7045 if (ReputationRank const* repRank = selfPlayerOwner->GetReputationMgr().GetForcedRankIfAny(targetFactionTemplateEntry))
7046 return *repRank;
7047 }
7048 else if (targetPlayerOwner)
7049 {
7050 if (FactionTemplateEntry const* selfFactionTemplateEntry = GetFactionTemplateEntry())
7051 if (ReputationRank const* repRank = targetPlayerOwner->GetReputationMgr().GetForcedRankIfAny(selfFactionTemplateEntry))
7052 return *repRank;
7053 }
7054
7056 {
7057 if (target->HasUnitFlag(UNIT_FLAG_PLAYER_CONTROLLED))
7058 {
7059 if (selfPlayerOwner && targetPlayerOwner)
7060 {
7061 // always friendly to other unit controlled by player, or to the player himself
7062 if (selfPlayerOwner == targetPlayerOwner)
7063 return REP_FRIENDLY;
7064
7065 // duel - always hostile to opponent
7066 if (selfPlayerOwner->duel && selfPlayerOwner->duel->Opponent == targetPlayerOwner && selfPlayerOwner->duel->State == DUEL_STATE_IN_PROGRESS)
7067 return REP_HOSTILE;
7068
7069 // same group - checks dependant only on our faction - skip FFA_PVP for example
7070 if (selfPlayerOwner->IsInRaidWith(targetPlayerOwner))
7071 return REP_FRIENDLY; // return true to allow config option AllowTwoSide.Interaction.Group to work
7072 // however client seems to allow mixed group parties, because in 13850 client it works like:
7073 // return GetFactionReactionTo(GetFactionTemplateEntry(), target);
7074 }
7075
7076 // check FFA_PVP
7077 if (IsFFAPvP() && target->IsFFAPvP())
7078 return REP_HOSTILE;
7079
7080 if (selfPlayerOwner)
7081 {
7082 if (FactionTemplateEntry const* targetFactionTemplateEntry = target->GetFactionTemplateEntry())
7083 {
7084 if (ReputationRank const* repRank = selfPlayerOwner->GetReputationMgr().GetForcedRankIfAny(targetFactionTemplateEntry))
7085 return *repRank;
7086 if (!selfPlayerOwner->HasUnitFlag2(UNIT_FLAG2_IGNORE_REPUTATION))
7087 {
7088 if (FactionEntry const* targetFactionEntry = sFactionStore.LookupEntry(targetFactionTemplateEntry->faction))
7089 {
7090 if (targetFactionEntry->CanHaveReputation())
7091 {
7092 // check contested flags
7093 if (targetFactionTemplateEntry->factionFlags & FACTION_TEMPLATE_FLAG_ATTACK_PVP_ACTIVE_PLAYERS
7094 && selfPlayerOwner->HasPlayerFlag(PLAYER_FLAGS_CONTESTED_PVP))
7095 return REP_HOSTILE;
7096
7097 // if faction has reputation, hostile state depends only from AtWar state
7098 if (selfPlayerOwner->GetReputationMgr().IsAtWar(targetFactionEntry))
7099 return REP_HOSTILE;
7100 return REP_FRIENDLY;
7101 }
7102 }
7103 }
7104 }
7105 }
7106 }
7107 }
7108
7109 ReputationRank repRank = REP_HATED;
7110 if (!sScriptMgr->IfNormalReaction(this, target, repRank))
7111 {
7112 return ReputationRank(repRank);
7113 }
7114
7115 FactionTemplateEntry const* factionTemplateEntry = nullptr;
7116 if (checkOriginalFaction)
7117 {
7118 if (IsPlayer())
7119 {
7120 if (ChrRacesEntry const* rEntry = sChrRacesStore.LookupEntry(getRace()))
7121 {
7122 factionTemplateEntry = sFactionTemplateStore.LookupEntry(rEntry->FactionID);
7123 }
7124 }
7125 else
7126 {
7127 Unit* owner = GetOwner();
7128 if (HasUnitTypeMask(UNIT_MASK_MINION) && owner)
7129 {
7130 factionTemplateEntry = sFactionTemplateStore.LookupEntry(owner->GetFaction());
7131 }
7132 else if (CreatureTemplate const* cinfo = ToCreature()->GetCreatureTemplate())
7133 {
7134 factionTemplateEntry = sFactionTemplateStore.LookupEntry(cinfo->faction);
7135 }
7136 }
7137 }
7138
7139 if (!factionTemplateEntry)
7140 {
7141 factionTemplateEntry = GetFactionTemplateEntry();
7142 }
7143
7144 // do checks dependant only on our faction
7145 return GetFactionReactionTo(factionTemplateEntry, target);
7146}
DBCStorage< ChrRacesEntry > sChrRacesStore(ChrRacesEntryfmt)
@ REP_HATED
Definition SharedDefines.h:180
bool HasPlayerFlag(PlayerFlags flags) const
Definition Player.h:1123
bool IsAtWar(uint32 faction_id) const
Definition ReputationMgr.cpp:55
ReputationRank GetFactionReactionTo(FactionTemplateEntry const *factionTemplateEntry, Unit const *target) const
Definition Unit.cpp:7148
bool IsInRaidWith(Unit const *unit) const
Definition Unit.cpp:15163
Definition DBCStructure.h:679

References Player::duel, DUEL_STATE_IN_PROGRESS, FACTION_TEMPLATE_FLAG_ATTACK_PVP_ACTIVE_PLAYERS, GetAffectingPlayer(), GetCharmerOrOwnerOrSelf(), GetFaction(), GetFactionReactionTo(), GetFactionTemplateEntry(), ReputationMgr::GetForcedRankIfAny(), GetOwner(), getRace(), Player::GetReputationMgr(), Player::HasPlayerFlag(), HasUnitFlag(), HasUnitFlag2(), HasUnitTypeMask(), ReputationMgr::IsAtWar(), IsFFAPvP(), IsInRaidWith(), Object::IsPlayer(), PLAYER_FLAGS_CONTESTED_PVP, REP_FRIENDLY, REP_HATED, REP_HOSTILE, sChrRacesStore, sFactionStore, sFactionTemplateStore, sScriptMgr, Object::ToCreature(), UNIT_FLAG2_IGNORE_REPUTATION, UNIT_FLAG_PLAYER_CONTROLLED, and UNIT_MASK_MINION.

Referenced by _IsValidAssistTarget(), _IsValidAttackTarget(), GetDispellableAuraList(), Player::GetNPCIfCanInteractWith(), IsFriendlyTo(), IsHostileTo(), and Condition::Meets().

◆ GetRedirectThreatPercent()

uint32 Unit::GetRedirectThreatPercent ( )
inline
uint32 GetThreatPct() const
Definition ThreatMgr.h:303

References _redirectThreatInfo, and RedirectThreatInfo::GetThreatPct().

Referenced by ThreatMgr::DoAddThreat().

◆ GetRedirectThreatTarget()

Unit * Unit::GetRedirectThreatTarget ( ) const

◆ GetResistance() [1/2]

uint32 Unit::GetResistance ( SpellSchoolMask  mask) const
16428{
16429 int32 resist = -1;
16430 for (int i = SPELL_SCHOOL_NORMAL; i < MAX_SPELL_SCHOOL; ++i)
16431 if (mask & (1 << i) && (resist < 0 || resist > int32(GetResistance(SpellSchools(i)))))
16432 resist = int32(GetResistance(SpellSchools(i)));
16433
16434 // resist value will never be negative here
16435 return uint32(resist);
16436}

References GetResistance(), MAX_SPELL_SCHOOL, and SPELL_SCHOOL_NORMAL.

Referenced by Player::_SaveStats(), GetArmor(), GetEffectiveResistChance(), GetResistance(), and Player::outDebugValues().

◆ GetResistance() [2/2]

uint32 Unit::GetResistance ( SpellSchools  school) const
inline
1186{ return GetUInt32Value(static_cast<uint16>(UNIT_FIELD_RESISTANCES) + school); }
@ UNIT_FIELD_RESISTANCES
Definition UpdateFields.h:156

References Object::GetUInt32Value(), and UNIT_FIELD_RESISTANCES.

◆ GetShapeshiftForm()

◆ GetSharedVisionList()

◆ GetSheath()

SheathState Unit::GetSheath ( ) const
inline
SheathState
Definition UnitDefines.h:125

References Object::GetByteValue(), and UNIT_FIELD_BYTES_2.

◆ GetShieldBlockValue() [1/2]

virtual uint32 Unit::GetShieldBlockValue ( ) const
pure virtual

◆ GetShieldBlockValue() [2/2]

uint32 Unit::GetShieldBlockValue ( uint32  soft_cap,
uint32  hard_cap 
) const
inline
1165 {
1166 uint32 value = GetShieldBlockValue();
1167 if (value >= hard_cap)
1168 {
1169 value = (soft_cap + hard_cap) / 2;
1170 }
1171 else if (value > soft_cap)
1172 {
1173 value = soft_cap + ((value - soft_cap) / 2);
1174 }
1175
1176 return value;
1177 }

References GetShieldBlockValue().

◆ GetSingleCastAuras() [1/2]

AuraList & Unit::GetSingleCastAuras ( )
inline

◆ GetSingleCastAuras() [2/2]

AuraList const & Unit::GetSingleCastAuras ( ) const
inline
1419{ return m_scAuras; }

References m_scAuras.

◆ GetSpeed()

◆ GetSpeedRate()

◆ GetSpellCritChanceReduction()

float Unit::GetSpellCritChanceReduction ( ) const
inline

◆ GetSpellCritDamageReduction()

◆ GetSpellDamageReduction()

uint32 Unit::GetSpellDamageReduction ( uint32  damage) const
inline

◆ GetSpellMaxRangeForTarget()

float Unit::GetSpellMaxRangeForTarget ( Unit const *  target,
SpellInfo const *  spellInfo 
) const
12028{
12029 if (!spellInfo->RangeEntry)
12030 {
12031 return 0;
12032 }
12033
12034 if (spellInfo->RangeEntry->RangeMax[1] == spellInfo->RangeEntry->RangeMax[0])
12035 {
12036 return spellInfo->GetMaxRange();
12037 }
12038
12039 if (!target)
12040 {
12041 return spellInfo->GetMaxRange(true);
12042 }
12043
12044 return spellInfo->GetMaxRange(!IsHostileTo(target));
12045}

References SpellInfo::GetMaxRange(), IsHostileTo(), SpellInfo::RangeEntry, and SpellRangeEntry::RangeMax.

Referenced by spell_sha_fire_nova::CheckFireTotem(), Spell::CheckRange(), SpellTargetSelector::operator()(), SmartScript::ProcessAction(), ScriptedAI::SelectSpell(), GameObject::TriggeringLinkedGameObject(), and Pet::Update().

◆ GetSpellMinRangeForTarget()

float Unit::GetSpellMinRangeForTarget ( Unit const *  target,
SpellInfo const *  spellInfo 
) const
12048{
12049 if (!spellInfo->RangeEntry)
12050 {
12051 return 0;
12052 }
12053
12054 if (spellInfo->RangeEntry->RangeMin[1] == spellInfo->RangeEntry->RangeMin[0])
12055 {
12056 return spellInfo->GetMinRange();
12057 }
12058
12059 return spellInfo->GetMinRange(!IsHostileTo(target));
12060}

References SpellInfo::GetMinRange(), IsHostileTo(), SpellInfo::RangeEntry, and SpellRangeEntry::RangeMin.

Referenced by Spell::CheckRange(), SpellTargetSelector::operator()(), SmartScript::ProcessAction(), and ScriptedAI::SelectSpell().

◆ GetSpellModOwner()

Player * Unit::GetSpellModOwner ( ) const
13065{
13066 if (Player* player = const_cast<Unit*>(this)->ToPlayer())
13067 {
13068 return player;
13069 }
13070
13071 if (Unit* owner = GetOwner())
13072 {
13073 if (Player* player = owner->ToPlayer())
13074 {
13075 return player;
13076 }
13077 }
13078
13079 // Special handling for Eye of Kilrogg
13081 {
13082 if (TempSummon const* tempSummon = ToTempSummon())
13083 {
13084 if (Unit* summoner = tempSummon->GetSummonerUnit())
13085 {
13086 return summoner->ToPlayer();
13087 }
13088 }
13089 }
13090
13091 return nullptr;
13092}
@ NPC_EYE_OF_KILROGG
Definition PetDefines.h:102
Definition TemporarySummon.h:50

References Object::GetEntry(), GetOwner(), NPC_EYE_OF_KILROGG, Object::ToPlayer(), and ToTempSummon().

Referenced by Spell::_cast(), Creature::AddSpellCooldown(), ApplyEffectModifiers(), CalcArmorReducedDamage(), SpellEffectInfo::CalcDamageMultiplier(), Aura::CalcDispelChance(), Aura::CalcMaxCharges(), Aura::CalcMaxDuration(), AuraEffect::CalcPeriodicCritChance(), SpellInfo::CalcPowerCost(), Aura::CalcProcChance(), SpellEffectInfo::CalcRadius(), ThreatCalcHelper::calcThreat(), spell_dru_brambles_treant::CalculateAmount(), AuraEffect::CalculatePeriodic(), CalculateSpellDamageTaken(), SpellEffectInfo::CalcValueMultiplier(), Spell::cancel(), Spell::cast(), Spell::CheckRange(), Spell::CheckRuneCost(), Spell::EffectSummonPet(), Spell::EffectSummonType(), Spell::finish(), GetEffectiveResistChance(), SpellInfo::GetMaxRange(), GetPPMProcChance(), Spell::handle_delayed(), Spell::handle_immediate(), IsAlwaysDetectableFor(), MagicSpellHitResult(), MeleeSpellMissChance(), ModSpellCastTime(), Spell::SelectImplicitChainTargets(), Aura::SetDuration(), SpellCriticalDamageBonus(), SpellCriticalHealingBonus(), SpellDamageBonusDone(), SpellDoneCritChance(), SpellHealingBonusDone(), SpellHealingBonusTaken(), Spell::SummonGuardian(), Spell::TakePower(), Spell::TakeRunePower(), Spell::UpdateChanneledTargetList(), and Aura::UpdateOwner().

◆ GetSpellSchoolByAuraGroup()

SpellSchools Unit::GetSpellSchoolByAuraGroup ( UnitMods  unitMod) const
12356{
12358
12359 switch (unitMod)
12360 {
12362 school = SPELL_SCHOOL_HOLY;
12363 break;
12365 school = SPELL_SCHOOL_FIRE;
12366 break;
12368 school = SPELL_SCHOOL_NATURE;
12369 break;
12371 school = SPELL_SCHOOL_FROST;
12372 break;
12374 school = SPELL_SCHOOL_SHADOW;
12375 break;
12377 school = SPELL_SCHOOL_ARCANE;
12378 break;
12379
12380 default:
12381 break;
12382 }
12383
12384 return school;
12385}
@ SPELL_SCHOOL_SHADOW
Definition SharedDefines.h:299
@ SPELL_SCHOOL_NATURE
Definition SharedDefines.h:297
@ SPELL_SCHOOL_FROST
Definition SharedDefines.h:298
@ SPELL_SCHOOL_ARCANE
Definition SharedDefines.h:300
@ SPELL_SCHOOL_FIRE
Definition SharedDefines.h:296
@ SPELL_SCHOOL_HOLY
Definition SharedDefines.h:295
@ UNIT_MOD_RESISTANCE_SHADOW
Definition Unit.h:168
@ UNIT_MOD_RESISTANCE_FROST
Definition Unit.h:167
@ UNIT_MOD_RESISTANCE_HOLY
Definition Unit.h:164
@ UNIT_MOD_RESISTANCE_ARCANE
Definition Unit.h:169
@ UNIT_MOD_RESISTANCE_FIRE
Definition Unit.h:165
@ UNIT_MOD_RESISTANCE_NATURE
Definition Unit.h:166

References SPELL_SCHOOL_ARCANE, SPELL_SCHOOL_FIRE, SPELL_SCHOOL_FROST, SPELL_SCHOOL_HOLY, SPELL_SCHOOL_NATURE, SPELL_SCHOOL_NORMAL, SPELL_SCHOOL_SHADOW, UNIT_MOD_RESISTANCE_ARCANE, UNIT_MOD_RESISTANCE_FIRE, UNIT_MOD_RESISTANCE_FROST, UNIT_MOD_RESISTANCE_HOLY, UNIT_MOD_RESISTANCE_NATURE, and UNIT_MOD_RESISTANCE_SHADOW.

Referenced by UpdateUnitMod().

◆ getStandState()

◆ GetStat()

◆ GetStatByAuraGroup()

Stats Unit::GetStatByAuraGroup ( UnitMods  unitMod) const
12388{
12389 Stats stat = STAT_STRENGTH;
12390
12391 switch (unitMod)
12392 {
12394 stat = STAT_STRENGTH;
12395 break;
12397 stat = STAT_AGILITY;
12398 break;
12400 stat = STAT_STAMINA;
12401 break;
12403 stat = STAT_INTELLECT;
12404 break;
12406 stat = STAT_SPIRIT;
12407 break;
12408
12409 default:
12410 break;
12411 }
12412
12413 return stat;
12414}
Stats
Definition SharedDefines.h:268
@ STAT_SPIRIT
Definition SharedDefines.h:273
@ STAT_INTELLECT
Definition SharedDefines.h:272
@ STAT_AGILITY
Definition SharedDefines.h:270
@ STAT_STRENGTH
Definition SharedDefines.h:269
@ STAT_STAMINA
Definition SharedDefines.h:271
@ UNIT_MOD_STAT_INTELLECT
Definition Unit.h:153
@ UNIT_MOD_STAT_SPIRIT
Definition Unit.h:154
@ UNIT_MOD_STAT_STRENGTH
Definition Unit.h:150
@ UNIT_MOD_STAT_AGILITY
Definition Unit.h:151
@ UNIT_MOD_STAT_STAMINA
Definition Unit.h:152

References STAT_AGILITY, STAT_INTELLECT, STAT_SPIRIT, STAT_STAMINA, STAT_STRENGTH, UNIT_MOD_STAT_AGILITY, UNIT_MOD_STAT_INTELLECT, UNIT_MOD_STAT_SPIRIT, UNIT_MOD_STAT_STAMINA, and UNIT_MOD_STAT_STRENGTH.

Referenced by UpdateUnitMod().

◆ GetTarget()

◆ GetThreatMgr() [1/2]

ThreatMgr & Unit::GetThreatMgr ( )
inline
947{ return m_ThreatMgr; }

References m_ThreatMgr.

Referenced by CreatureAI::_EnterEvadeMode(), npc_vengeful_shade::npc_vengeful_shadeAI::AttackStart(), boss_hazzarah::CanAIAttack(), boss_renataki::boss_renatakiAI::CanAIAttack(), boss_mor_grayhoof::CastRandomSpell(), CleanupBeforeRemoveFromMap(), boss_eadric::boss_eadricAI::DamageTaken(), boss_paletress::boss_paletressAI::DamageTaken(), boss_grand_champion::boss_grand_championAI::DamageTaken(), boss_lady_deathwhisper::boss_lady_deathwhisperAI::DamageTaken(), npc_magister_aledis::DamageTaken(), boss_ysondre::boss_ysondreAI::DamageTaken(), npc_tapoke_slim_jahn::npc_tapoke_slim_jahnAI::DamageTaken(), npc_dark_nucleus::npc_dark_nucleusAI::DamageTaken(), boss_thorim_start_npcs::DamageTaken(), npc_crok_scourgebane::npc_crok_scourgebaneAI::DoAction(), npc_spark_of_ionar::DoAction(), UnitAI::DoAddAuraToAllHostilePlayers(), ScriptedAI::DoAddThreat(), UnitAI::DoCastToAllHostilePlayers(), npc_taskmaster_fizzule::npc_taskmaster_fizzuleAI::DoFriend(), ScriptedAI::DoGetThreat(), ScriptedAI::DoModifyThreatByPercent(), npc_unkor_the_ruthless::npc_unkor_the_ruthlessAI::DoNice(), ScriptedAI::DoResetThreat(), ScriptedAI::DoResetThreatList(), Spell::EffectModifyThreatPercent(), Spell::EffectTaunt(), boss_faction_championsAI::EnemiesInRange(), boss_ragnaros::boss_ragnarosAI::EnterEvadeMode(), npc_tirion_fordring_tft::npc_tirion_fordringAI::EnterEvadeMode(), boss_murmur::EnterEvadeMode(), boss_alar::EnterEvadeMode(), GuardAI::EnterEvadeMode(), boss_doomrel::boss_doomrelAI::EnterEvadeMode(), npc_varian_wrynn::npc_varian_wrynnAI::EnterEvadeMode(), npc_thrall_bfu::npc_thrall_bfuAI::EnterEvadeMode(), boss_ouro::EnterEvadeMode(), npc_pos_freed_slave::npc_pos_freed_slaveAI::EnterEvadeMode(), npc_high_overlord_saurfang_igb::npc_high_overlord_saurfang_igbAI::EnterEvadeMode(), npc_muradin_bronzebeard_igb::npc_muradin_bronzebeard_igbAI::EnterEvadeMode(), gunship_npc_AI::EnterEvadeMode(), npc_gunship_boarding_addAI::EnterEvadeMode(), npc_terenas_menethil::npc_terenas_menethilAI::EnterEvadeMode(), violet_hold_trashAI::EnterEvadeMode(), npc_pet_hunter_snake_trap::EnterEvadeMode(), npc_escortAI::EnterEvadeMode(), FollowerAI::EnterEvadeMode(), npc_crystalline_frayer::EnterSeedPod(), TemporaryThreatModifierEvent::Execute(), StartMovementEvent::Execute(), boss_supremus::FindHatefulStrikeTarget(), npc_raging_flames::FixateRandomTarget(), SmartScript::GetTargets(), UnitAI::GetThreatMgr(), debug_commandscript::HandleDebugThreatListCommand(), spell_karazhan_blink::HandleDummy(), spell_kaelthas_mind_control::HandleEffect(), spell_tharon_ja_dummy_aura::HandleEffectRemove(), spell_q11919_q11940_drake_hunt_aura::HandleEffectRemove(), spell_enveloping_webs::HandleOnHit(), spell_arcane_vacuum::HandleOnHit(), spell_pet_guard_dog::HandleProc(), PetAI::HandleReturnMovement(), spell_pursue::HandleScript(), spell_gurtogg_eject::HandleScriptEffect(), spell_leotheras_whirlwind::HandleScriptEffect(), spell_black_knight_ghoul_claw::HandleSpellHit(), boss_thaddius::boss_thaddiusAI::IsAnyPlayerInMeleeRange(), boss_hadronox::IsInCombatWithPlayer(), boss_attumen::IsSummonedBy(), boss_talon_king_ikiss::JustEngagedWith(), boss_blackheart_the_inciter::JustEngagedWith(), boss_teron_gorefiend::JustEngagedWith(), boss_high_astromancer_solarian::JustEngagedWith(), boss_jindo::JustSummoned(), Kill(), boss_urom::boss_uromAI::LeaveCombat(), Creature::ModifyThreatPercentTemp(), boss_bug_trio::MovementInform(), npc_pet_mage_mirror_image::MySelectNextTarget(), spell_halion_twilight_phasing_aura::OnApply(), spell_halion_twilight_phasing_aura::OnRemove(), spell_malygos_vortex_visual::OnRemove(), NonTankTargetSelector::operator()(), PowerUsersSelector::operator()(), MalleableGooSelector::operator()(), StoneGripTargetSelector::operator()(), boss_jeklik::PathEndReached(), SmartScript::ProcessAction(), SmartScript::ProcessEvent(), boss_priestess_lackey_commonAI::RecalculateThreat(), boss_faction_championsAI::RecalculateThreat(), boss_tharon_ja::boss_tharon_jaAI::Reset(), boss_talon_king_ikiss::Reset(), boss_faction_championsAI::SelectEnemyCaster(), npc_scholomance_occultist::npc_scholomance_occultistAI::SelectUnitCasting(), SendChangeCurrentVictimOpcode(), SendThreatListUpdate(), setDeathState(), SetPhaseMask(), npc_ulduar_iron_construct::SpellHit(), npc_frostwing_vrykul::npc_frostwing_vrykulAI::SpellHitTarget(), boss_eck::SpellHitTarget(), boss_ouro::SpellHitTarget(), spell_putricide_ooze_channel::StartAttack(), BossAI::TeleportCheaters(), Creature::Update(), Update(), boss_drakkisath::boss_drakkisathAI::UpdateAI(), boss_nefarian::UpdateAI(), npc_highlord_darion_mograine::npc_highlord_darion_mograineAI::UpdateAI(), boss_grilek::boss_grilekAI::UpdateAI(), boss_hakkar::boss_hakkarAI::UpdateAI(), boss_jindo::UpdateAI(), boss_mandokir::boss_mandokirAI::UpdateAI(), boss_renataki::boss_renatakiAI::UpdateAI(), boss_sartura::UpdateAI(), npc_sartura_royal_guard::UpdateAI(), npc_toc5_grand_champion_minion::npc_toc5_grand_champion_minionAI::UpdateAI(), boss_grand_champion::boss_grand_championAI::UpdateAI(), npc_snobold_vassal::npc_snobold_vassalAI::UpdateAI(), npc_raging_spirit::npc_raging_spiritAI::UpdateAI(), npc_green_dragon_combat_trigger::npc_green_dragon_combat_triggerAI::UpdateAI(), boss_gothik::boss_gothikAI::UpdateAI(), boss_kelthuzad::boss_kelthuzadAI::UpdateAI(), boss_patchwerk::boss_patchwerkAI::UpdateAI(), boss_sapphiron::boss_sapphironAI::UpdateAI(), boss_thaddius_summon::boss_thaddius_summonAI::UpdateAI(), boss_malygos::UpdateAI(), npc_molten_golem::UpdateAI(), boss_palehoof::boss_palehoofAI::UpdateAI(), npc_frozen_orb::npc_frozen_orbAI::UpdateAI(), boss_the_lurker_below::UpdateAI(), npc_aeranas::npc_aeranasAI::UpdateAI(), boss_netherspite::UpdatePortals(), CreatureAI::UpdateVictim(), and instance_eye_of_eternity::VortexHandling().

◆ GetThreatMgr() [2/2]

ThreatMgr const & Unit::GetThreatMgr ( ) const
inline
948{ return m_ThreatMgr; }

References m_ThreatMgr.

◆ GetTotalAttackPowerValue()

float Unit::GetTotalAttackPowerValue ( WeaponAttackType  attType,
Unit pVictim = nullptr 
) const
12439{
12440 if (attType == RANGED_ATTACK)
12441 {
12443 if (victim)
12444 ap += victim->GetTotalAuraModifier(SPELL_AURA_RANGED_ATTACK_POWER_ATTACKER_BONUS);
12445
12446 if (ap < 0)
12447 return 0.0f;
12449 }
12450 else
12451 {
12453 if (victim)
12454 ap += victim->GetTotalAuraModifier(SPELL_AURA_MELEE_ATTACK_POWER_ATTACKER_BONUS);
12455
12456 if (ap < 0)
12457 return 0.0f;
12459 }
12460}
@ SPELL_AURA_RANGED_ATTACK_POWER_ATTACKER_BONUS
Definition SpellAuraDefines.h:190
@ SPELL_AURA_MELEE_ATTACK_POWER_ATTACKER_BONUS
Definition SpellAuraDefines.h:228
@ UNIT_FIELD_ATTACK_POWER_MODS
Definition UpdateFields.h:163
@ UNIT_FIELD_RANGED_ATTACK_POWER
Definition UpdateFields.h:165
@ UNIT_FIELD_RANGED_ATTACK_POWER_MULTIPLIER
Definition UpdateFields.h:167
@ UNIT_FIELD_ATTACK_POWER_MULTIPLIER
Definition UpdateFields.h:164
@ UNIT_FIELD_ATTACK_POWER
Definition UpdateFields.h:162
@ UNIT_FIELD_RANGED_ATTACK_POWER_MODS
Definition UpdateFields.h:166
int32 GetInt32Value(uint16 index) const
Definition Object.cpp:288

References Object::GetFloatValue(), Object::GetInt32Value(), GetTotalAuraModifier(), RANGED_ATTACK, SPELL_AURA_MELEE_ATTACK_POWER_ATTACKER_BONUS, SPELL_AURA_RANGED_ATTACK_POWER_ATTACKER_BONUS, UNIT_FIELD_ATTACK_POWER, UNIT_FIELD_ATTACK_POWER_MODS, UNIT_FIELD_ATTACK_POWER_MULTIPLIER, UNIT_FIELD_RANGED_ATTACK_POWER, UNIT_FIELD_RANGED_ATTACK_POWER_MODS, and UNIT_FIELD_RANGED_ATTACK_POWER_MULTIPLIER.

Referenced by spell_dk_ghoul_thrash::CalcDamage(), Creature::CalculateMinMaxDamage(), Player::CalculateMinMaxDamage(), Spell::EffectSchoolDMG(), Spell::EffectWeaponDmg(), spell_warr_execute::HandleEffect(), spell_sha_shamanistic_rage::HandleProc(), spell_pal_seal_of_righteousness::HandleProc(), Spell::HandleThreatSpells(), Guardian::InitStatsForLevel(), SpellBaseDamageBonusDone(), SpellBaseHealingBonusDone(), SpellDamageBonusDone(), SpellHealingBonusDone(), Guardian::UpdateDamagePhysical(), and lfg::LFGMgr::UpdateRaidBrowser().

◆ GetTotalAuraModifier() [1/2]

int32 Unit::GetTotalAuraModifier ( AuraType  auratype) const
6233{
6234 return GetTotalAuraModifier(auraType, [](AuraEffect const* /*aurEff*/) { return true; });
6235}

References GetTotalAuraModifier().

Referenced by Player::AddSpellAndCategoryCooldowns(), CalcArmorReducedDamage(), Aura::CalcDispelChance(), CalculateMeleeDamage(), Player::CalculateReputationGain(), CalculateSpellDamageTaken(), DealMeleeDamage(), Spell::Delayed(), Spell::DelayedChannel(), Creature::GetAggroRange(), Creature::GetAttackDistance(), GetTotalAttackPowerValue(), GetTotalAuraModifier(), GetTotalAuraModifierByAffectMask(), GetTotalAuraModifierByMiscMask(), GetTotalAuraModifierByMiscValue(), GetUnitBlockChance(), GetUnitCriticalChance(), GetUnitDodgeChance(), GetUnitMissChance(), GetUnitParryChance(), Player::HandleFall(), isBlockCritical(), MagicSpellHitResult(), MeleeDamageBonusDone(), MeleeDamageBonusTaken(), MeleeSpellHitResult(), RecalculateObjectScale(), Creature::RegenerateHealth(), Player::RegenerateHealth(), RewardRage(), RollMeleeOutcomeAgainst(), SpellBaseDamageBonusDone(), SpellBaseDamageBonusTaken(), SpellBaseHealingBonusDone(), SpellDamageBonusDone(), SpellDoneCritChance(), SpellHitResult(), SpellHitResult(), SpellTakenCritChance(), Player::UpdateBlockPercentage(), UpdateDamageDoneMods(), Player::UpdateDodgePercentage(), Player::UpdateExpertise(), Player::UpdateManaRegen(), Player::UpdateMeleeHitChances(), Player::UpdateParryPercentage(), Player::UpdateRangedHitChances(), UpdateResistanceBuffModsMod(), UpdateSpeed(), Player::UpdateSpellCritChance(), Player::UpdateSpellHitChances(), UpdateStatBuffMod(), and Player::UpdateWeaponDependentCritAuras().

◆ GetTotalAuraModifier() [2/2]

int32 Unit::GetTotalAuraModifier ( AuraType  auratype,
std::function< bool(AuraEffect const *)> const &  predicate 
) const
6147{
6148 AuraEffectList const& mTotalAuraList = GetAuraEffectsByType(auraType);
6149 if (mTotalAuraList.empty())
6150 return 0;
6151
6152 std::map<SpellGroup, int32> sameEffectSpellGroup;
6153 int32 modifier = 0;
6154
6155 for (AuraEffect const* aurEff : mTotalAuraList)
6156 {
6157 if (predicate(aurEff))
6158 {
6159 // Check if the Aura Effect has a the Same Effect Stack Rule and if so, use the highest amount of that SpellGroup
6160 // If the Aura Effect does not have this Stack Rule, it returns false so we can add to the multiplier as usual
6161 if (!sSpellMgr->AddSameEffectStackRuleSpellGroups(aurEff->GetSpellInfo(), static_cast<uint32>(auraType), aurEff->GetAmount(), sameEffectSpellGroup))
6162 modifier += aurEff->GetAmount();
6163 }
6164 }
6165
6166 // Add the highest of the Same Effect Stack Rule SpellGroups to the accumulator
6167 for (auto const& [_, amount] : sameEffectSpellGroup)
6168 modifier += amount;
6169
6170 return modifier;
6171}

References GetAuraEffectsByType(), and sSpellMgr.

◆ GetTotalAuraModifierByAffectMask()

int32 Unit::GetTotalAuraModifierByAffectMask ( AuraType  auratype,
SpellInfo const *  affectedSpell 
) const
6333{
6334 return GetTotalAuraModifier(auraType, [affectedSpell](AuraEffect const* aurEff) -> bool
6335 {
6336 if (aurEff->IsAffectedOnSpell(affectedSpell))
6337 return true;
6338 return false;
6339 });
6340}

References GetTotalAuraModifier(), and AuraEffect::IsAffectedOnSpell().

Referenced by Spell::SelectImplicitAreaTargets(), and Spell::SelectImplicitConeTargets().

◆ GetTotalAuraModifierByMiscMask()

◆ GetTotalAuraModifierByMiscValue()

int32 Unit::GetTotalAuraModifierByMiscValue ( AuraType  auratype,
int32  misc_value 
) const
6293{
6294 return GetTotalAuraModifier(auraType, [miscValue](AuraEffect const* aurEff) -> bool
6295 {
6296 if (aurEff->GetMiscValue() == miscValue)
6297 return true;
6298 return false;
6299 });
6300}

References AuraEffect::GetMiscValue(), and GetTotalAuraModifier().

Referenced by Player::CalculateReputationGain(), GetMechanicResistChance(), MeleeSpellHitResult(), ModSpellDuration(), Creature::Regenerate(), Player::Regenerate(), RollMeleeOutcomeAgainst(), Player::UpdateEnergyRegen(), and Player::UpdateManaRegen().

◆ GetTotalAuraModValue()

float Unit::GetTotalAuraModValue ( UnitMods  unitMod) const
12338{
12339 if (unitMod >= UNIT_MOD_END)
12340 {
12341 LOG_ERROR("entities.unit", "attempt to access non-existing UnitMods in GetTotalAuraModValue()!");
12342 return 0.0f;
12343 }
12344
12345 if (GetPctModifierValue(unitMod, TOTAL_PCT) <= 0.0f)
12346 return 0.0f;
12347
12348 float value = GetFlatModifierValue(unitMod, BASE_VALUE);
12349 value *= GetPctModifierValue(unitMod, BASE_PCT);
12350 value += GetFlatModifierValue(unitMod, TOTAL_VALUE);
12351 value *= GetPctModifierValue(unitMod, TOTAL_PCT);
12352 return value;
12353}
float GetPctModifierValue(UnitMods unitMod, UnitModifierPctType modifierType) const
Definition Unit.cpp:12167
float GetFlatModifierValue(UnitMods unitMod, UnitModifierFlatType modifierType) const
Definition Unit.cpp:12156

References BASE_PCT, BASE_VALUE, GetFlatModifierValue(), GetPctModifierValue(), LOG_ERROR, TOTAL_PCT, TOTAL_VALUE, and UNIT_MOD_END.

Referenced by Creature::UpdateArmor(), Creature::UpdateMaxHealth(), Creature::UpdateMaxPower(), and Creature::UpdateResistances().

◆ GetTotalAuraMultiplier() [1/2]

◆ GetTotalAuraMultiplier() [2/2]

float Unit::GetTotalAuraMultiplier ( AuraType  auraType,
std::function< bool(AuraEffect const *)> const &  predicate 
) const
6174{
6175 AuraEffectList const& mTotalAuraList = GetAuraEffectsByType(auraType);
6176 if (mTotalAuraList.empty())
6177 return 1.0f;
6178
6179 std::map<SpellGroup, int32> sameEffectSpellGroup;
6180 float multiplier = 1.0f;
6181
6182 for (AuraEffect const* aurEff : mTotalAuraList)
6183 {
6184 if (predicate(aurEff))
6185 {
6186 // Check if the Aura Effect has a the Same Effect Stack Rule and if so, use the highest amount of that SpellGroup
6187 // If the Aura Effect does not have this Stack Rule, it returns false so we can add to the multiplier as usual
6188 if (!sSpellMgr->AddSameEffectStackRuleSpellGroups(aurEff->GetSpellInfo(), static_cast<uint32>(auraType), aurEff->GetAmount(), sameEffectSpellGroup))
6189 AddPct(multiplier, aurEff->GetAmount());
6190 }
6191 }
6192
6193 // Add the highest of the Same Effect Stack Rule SpellGroups to the multiplier
6194 for (auto itr = sameEffectSpellGroup.begin(); itr != sameEffectSpellGroup.end(); ++itr)
6195 AddPct(multiplier, itr->second);
6196
6197 return multiplier;
6198}

References AddPct(), GetAuraEffectsByType(), and sSpellMgr.

◆ GetTotalAuraMultiplierByAffectMask()

float Unit::GetTotalAuraMultiplierByAffectMask ( AuraType  auratype,
SpellInfo const *  affectedSpell 
) const
6343{
6344 return GetTotalAuraMultiplier(auraType, [affectedSpell](AuraEffect const* aurEff) -> bool
6345 {
6346 if (aurEff->IsAffectedOnSpell(affectedSpell))
6347 return true;
6348 return false;
6349 });
6350}

References GetTotalAuraMultiplier(), and AuraEffect::IsAffectedOnSpell().

◆ GetTotalAuraMultiplierByMiscMask()

float Unit::GetTotalAuraMultiplierByMiscMask ( AuraType  auratype,
uint32  misc_mask 
) const

◆ GetTotalAuraMultiplierByMiscValue()

float Unit::GetTotalAuraMultiplierByMiscValue ( AuraType  auratype,
int32  misc_value 
) const
6303{
6304 return GetTotalAuraMultiplier(auraType, [miscValue](AuraEffect const* aurEff) -> bool
6305 {
6306 if (aurEff->GetMiscValue() == miscValue)
6307 return true;
6308 return false;
6309 });
6310}

References AuraEffect::GetMiscValue(), and GetTotalAuraMultiplier().

Referenced by AuraEffect::HandleAuraModIncreaseEnergyPercent(), Creature::Regenerate(), Player::Regenerate(), Player::UpdateEnergyRegen(), and Player::UpdateManaRegen().

◆ GetTotalStatValue()

float Unit::GetTotalStatValue ( Stats  stat,
float  additionalValue = 0.0f 
) const
12322{
12323 UnitMods unitMod = UnitMods(static_cast<uint16>(UNIT_MOD_STAT_START) + stat);
12324
12325 if (GetPctModifierValue(unitMod, TOTAL_PCT) <= 0.0f)
12326 return 0.0f;
12327
12328 // value = ((base_value * base_pct) + total_value) * total_pct
12329 float value = GetFlatModifierValue(unitMod, BASE_VALUE) + GetCreateStat(stat);
12330 value *= GetPctModifierValue(unitMod, BASE_PCT);
12331 value += GetFlatModifierValue(unitMod, TOTAL_VALUE) + additionalValue;
12332 value *= GetPctModifierValue(unitMod, TOTAL_PCT);
12333
12334 return value;
12335}
UnitMods
Definition Unit.h:149
@ UNIT_MOD_STAT_START
Definition Unit.h:177
float GetCreateStat(Stats stat) const
Definition Unit.h:1052

References BASE_PCT, BASE_VALUE, GetCreateStat(), GetFlatModifierValue(), GetPctModifierValue(), TOTAL_PCT, TOTAL_VALUE, and UNIT_MOD_STAT_START.

Referenced by Player::UpdateAllStats(), Guardian::UpdateStats(), and Player::UpdateStats().

◆ getTransForm()

◆ GetTransGUID()

◆ GetUnitBlockChance()

float Unit::GetUnitBlockChance ( ) const
3824{
3825 if (Player const* player = ToPlayer())
3826 {
3827 if (player->CanBlock())
3828 {
3829 Item* tmpitem = player->GetUseableItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_OFFHAND);
3830 if (tmpitem && !tmpitem->IsBroken() && tmpitem->GetTemplate()->Block)
3832 }
3833 // is player but has no block ability or no not broken shield equipped
3834 return 0.0f;
3835 }
3836 else
3837 {
3838 if (ToCreature()->IsTotem())
3839 return 0.0f;
3840 else
3841 {
3842 float block = 5.0f;
3844 return block > 0.0f ? block : 0.0f;
3845 }
3846 }
3847}
@ EQUIPMENT_SLOT_OFFHAND
Definition Player.h:677
#define INVENTORY_SLOT_BAG_0
Definition Player.h:656
@ SPELL_AURA_MOD_BLOCK_PERCENT
Definition SpellAuraDefines.h:114
@ PLAYER_BLOCK_PERCENTAGE
Definition UpdateFields.h:346
bool IsBroken() const
Definition Item.h:257
uint32 Block
Definition ItemTemplate.h:674

References ItemTemplate::Block, EQUIPMENT_SLOT_OFFHAND, Object::GetFloatValue(), Item::GetTemplate(), GetTotalAuraModifier(), INVENTORY_SLOT_BAG_0, Item::IsBroken(), IsTotem(), PLAYER_BLOCK_PERCENTAGE, SPELL_AURA_MOD_BLOCK_PERCENT, Object::ToCreature(), and Object::ToPlayer().

Referenced by isSpellBlocked(), MeleeSpellHitResult(), and RollMeleeOutcomeAgainst().

◆ GetUnitCriticalChance()

float Unit::GetUnitCriticalChance ( WeaponAttackType  attackType,
Unit const *  victim 
) const
3850{
3851 float crit;
3852
3853 if (IsPlayer())
3854 {
3855 switch (attackType)
3856 {
3857 case BASE_ATTACK:
3859 break;
3860 case OFF_ATTACK:
3862 break;
3863 case RANGED_ATTACK:
3865 break;
3866 // Just for good manner
3867 default:
3868 crit = 0.0f;
3869 break;
3870 }
3871 }
3872 else
3873 {
3874 crit = 5.0f;
3877 }
3878
3879 // flat aura mods
3880 if (attackType == RANGED_ATTACK)
3881 crit += victim->GetTotalAuraModifier(SPELL_AURA_MOD_ATTACKER_RANGED_CRIT_CHANCE);
3882 else
3883 crit += victim->GetTotalAuraModifier(SPELL_AURA_MOD_ATTACKER_MELEE_CRIT_CHANCE);
3884
3885 crit += victim->GetTotalAuraModifier(SPELL_AURA_MOD_CRIT_CHANCE_FOR_CASTER, [this](AuraEffect const* aurEff)
3886 {
3887 return GetGUID() == aurEff->GetCasterGUID();
3888 });
3889
3890 // reduce crit chance from Rating for players
3891 if (attackType != RANGED_ATTACK)
3892 Unit::ApplyResilience(victim, &crit, nullptr, false, CR_CRIT_TAKEN_MELEE);
3893 else
3894 Unit::ApplyResilience(victim, &crit, nullptr, false, CR_CRIT_TAKEN_RANGED);
3895
3896 // Apply crit chance from defence skill
3897 crit += (int32(GetMaxSkillValueForLevel(victim)) - int32(victim->GetDefenseSkillValue(this))) * 0.04f;
3898
3899 // xinef: SPELL_AURA_MOD_ATTACKER_SPELL_AND_WEAPON_CRIT_CHANCE should be calculated at the end
3900 crit += victim->GetTotalAuraModifier(SPELL_AURA_MOD_ATTACKER_SPELL_AND_WEAPON_CRIT_CHANCE);
3901
3902 if (crit < 0.0f)
3903 crit = 0.0f;
3904 return crit;
3905}
@ SPELL_AURA_MOD_CRIT_CHANCE_FOR_CASTER
Definition SpellAuraDefines.h:371
@ SPELL_AURA_MOD_ATTACKER_RANGED_CRIT_CHANCE
Definition SpellAuraDefines.h:251
@ SPELL_AURA_MOD_ATTACKER_SPELL_AND_WEAPON_CRIT_CHANCE
Definition SpellAuraDefines.h:260
@ SPELL_AURA_MOD_CRIT_PCT
Definition SpellAuraDefines.h:353
@ SPELL_AURA_MOD_WEAPON_CRIT_PERCENT
Definition SpellAuraDefines.h:115
@ PLAYER_RANGED_CRIT_PERCENTAGE
Definition UpdateFields.h:352
@ PLAYER_CRIT_PERCENTAGE
Definition UpdateFields.h:351
@ PLAYER_OFFHAND_CRIT_PERCENTAGE
Definition UpdateFields.h:353
uint16 GetMaxSkillValueForLevel(Unit const *target=nullptr) const
Definition Unit.h:1193

References ApplyResilience(), BASE_ATTACK, CR_CRIT_TAKEN_MELEE, CR_CRIT_TAKEN_RANGED, AuraEffect::GetCasterGUID(), GetDefenseSkillValue(), Object::GetFloatValue(), Object::GetGUID(), GetMaxSkillValueForLevel(), GetTotalAuraModifier(), Object::IsPlayer(), OFF_ATTACK, PLAYER_CRIT_PERCENTAGE, PLAYER_OFFHAND_CRIT_PERCENTAGE, PLAYER_RANGED_CRIT_PERCENTAGE, RANGED_ATTACK, SPELL_AURA_MOD_ATTACKER_MELEE_CRIT_CHANCE, SPELL_AURA_MOD_ATTACKER_RANGED_CRIT_CHANCE, SPELL_AURA_MOD_ATTACKER_SPELL_AND_WEAPON_CRIT_CHANCE, SPELL_AURA_MOD_CRIT_CHANCE_FOR_CASTER, SPELL_AURA_MOD_CRIT_PCT, and SPELL_AURA_MOD_WEAPON_CRIT_PERCENT.

Referenced by spell_dk_wandering_plague_aura::CheckProc(), and RollMeleeOutcomeAgainst().

◆ GetUnitDodgeChance()

float Unit::GetUnitDodgeChance ( ) const
3762{
3763 if (IsPlayer())
3764 return ToPlayer()->GetRealDodge(); //GetFloatValue(PLAYER_DODGE_PERCENTAGE);
3765 else
3766 {
3767 if (ToCreature()->IsTotem())
3768 return 0.0f;
3769 else
3770 {
3771 float dodge = ToCreature()->isWorldBoss() ? 5.85f : 5.0f; // Xinef: bosses should have 6.5% dodge (5.9 + 0.6 from defense skill difference)
3773 return dodge > 0.0f ? dodge : 0.0f;
3774 }
3775 }
3776}
@ SPELL_AURA_MOD_DODGE_PERCENT
Definition SpellAuraDefines.h:112
float GetRealDodge() const
Definition Player.h:2639

References Player::GetRealDodge(), GetTotalAuraModifier(), Object::IsPlayer(), IsTotem(), Creature::isWorldBoss(), SPELL_AURA_MOD_DODGE_PERCENT, Object::ToCreature(), and Object::ToPlayer().

Referenced by MeleeSpellHitResult(), and RollMeleeOutcomeAgainst().

◆ GetUnitFlags()

◆ GetUnitFlags2()

UnitFlags2 Unit::GetUnitFlags2 ( ) const
inline

Remove all UnitFlags and set new ones. UnitFlags available in UnitDefines.h.

UnitFlags2
Definition UnitDefines.h:291
@ UNIT_FIELD_FLAGS_2
Definition UpdateFields.h:118

References Object::GetUInt32Value(), and UNIT_FIELD_FLAGS_2.

Referenced by npc_commandscript::HandleNpcInfoCommand().

◆ GetUnitMeleeSkill()

uint32 Unit::GetUnitMeleeSkill ( Unit const *  target = nullptr) const
inline
1179{ return (target ? getLevelForTarget(target) : GetLevel()) * 5; }

References GetLevel(), and getLevelForTarget().

Referenced by DealMeleeDamage(), GetDefenseSkillValue(), and GetWeaponSkillValue().

◆ GetUnitMissChance()

float Unit::GetUnitMissChance ( WeaponAttackType  attType) const
3809{
3810 float miss_chance = 5.00f;
3811
3812 if (Player const* player = ToPlayer())
3813 miss_chance += player->GetMissPercentageFromDefence();
3814
3815 if (attType == RANGED_ATTACK)
3817 else
3819
3820 return miss_chance;
3821}
@ SPELL_AURA_MOD_ATTACKER_MELEE_HIT_CHANCE
Definition SpellAuraDefines.h:247
@ SPELL_AURA_MOD_ATTACKER_RANGED_HIT_CHANCE
Definition SpellAuraDefines.h:248

References GetTotalAuraModifier(), RANGED_ATTACK, SPELL_AURA_MOD_ATTACKER_MELEE_HIT_CHANCE, SPELL_AURA_MOD_ATTACKER_RANGED_HIT_CHANCE, and Object::ToPlayer().

Referenced by MeleeSpellMissChance().

◆ GetUnitMovementFlags()

◆ GetUnitParryChance()

float Unit::GetUnitParryChance ( ) const
3779{
3780 float chance = 0.0f;
3781
3782 if (Player const* player = ToPlayer())
3783 {
3784 if (player->CanParry())
3785 {
3786 Item* tmpitem = player->GetWeaponForAttack(BASE_ATTACK, true);
3787 if (!tmpitem)
3788 tmpitem = player->GetWeaponForAttack(OFF_ATTACK, true);
3789
3790 if (tmpitem)
3791 chance = player->GetRealParry(); //GetFloatValue(PLAYER_PARRY_PERCENTAGE);
3792 }
3793 }
3794 else if (IsCreature())
3795 {
3796 if (ToCreature()->isWorldBoss())
3797 chance = 13.4f; // + 0.6 by skill diff
3799 chance = 5.0f;
3800
3801 // Xinef: if aura is present, type should not matter
3803 }
3804
3805 return chance > 0.0f ? chance : 0.0f;
3806}
@ SPELL_AURA_MOD_PARRY_PERCENT
Definition SpellAuraDefines.h:110

References BASE_ATTACK, CREATURE_TYPE_HUMANOID, GetCreatureType(), GetTotalAuraModifier(), Object::IsCreature(), OFF_ATTACK, SPELL_AURA_MOD_PARRY_PERCENT, Object::ToCreature(), and Object::ToPlayer().

Referenced by spell_dk_spell_deflection::Absorb(), MeleeSpellHitResult(), and RollMeleeOutcomeAgainst().

◆ GetUnitState()

uint32 Unit::GetUnitState ( ) const
inline

◆ GetUnitTypeMask()

uint32 Unit::GetUnitTypeMask ( ) const
inline
737{ return m_unitTypeMask; }

References m_unitTypeMask.

◆ GetVehicle()

Vehicle * Unit::GetVehicle ( ) const
inline
1909{ return m_vehicle; }

References m_vehicle.

Referenced by KillRewarder::_InitXP(), Vehicle::AddPassenger(), WorldSession::BuildPartyMemberStatsChangedPacket(), boss_the_lich_king::boss_the_lich_kingAI::CanAIAttack(), npc_shambling_horror_icc::npc_shambling_horror_iccAI::CanAIAttack(), npc_raging_spirit::npc_raging_spiritAI::CanAIAttack(), npc_icc_lk_checktarget::npc_icc_lk_checktargetAI::CanAIAttack(), boss_flame_leviathan_defense_turret::CanAIAttack(), instance_eye_of_eternity::CheckAchievementCriteriaMeet(), Spell::CheckCast(), Spell::EffectJumpDest(), Spell::EffectKnockBack(), CreatureAI::EnterEvadeMode(), GetDirectTransport(), SmartScript::GetTargets(), GetTransGUID(), WorldSession::HandleAttackSwingOpcode(), WorldSession::HandleChangeSeatsOnControlledVehicle(), spell_switch_infragreen_bomber_station::HandleDummy(), spell_fight_fire_bomber::HandleDummy(), WorldSession::HandleMoverRelocation(), WorldSession::HandleRequestPartyMemberStatsOpcode(), ArenaSpectator::HandleSpectatorSpectateCommand(), Player::IsPetNeedBeTemporaryUnsummoned(), npc_nexus_lord::JustDied(), npc_scion_of_eternity::JustDied(), boss_flame_leviathan_defense_turret::JustDied(), npc_mageguard_dalaran::npc_mageguard_dalaranAI::MoveInLineOfSight(), npc_scion_of_eternity::npc_scion_of_eternity(), achievement_flame_leviathan_garage::OnCheck(), achievement_wg_didnt_stand_a_chance::OnCheck(), npc_announcer_toc5::OnGossipHello(), BattlefieldWG::OnPlayerLeaveWar(), boss_flame_leviathan_overload_device::OnSpellClick(), VehicleCheck::operator()(), OutDebugInfo(), boss_flame_leviathan_seat::PassengerBoarded(), Player::ProcessDelayedOperations(), Player::ProcessTerrainStatusUpdate(), Vehicle::RemovePassenger(), Creature::SelectVictim(), SetControlled(), Player::SetViewpoint(), lfg::LFGMgr::TeleportPlayer(), npc_pilgrims_bounty_chair::UpdateAI(), npc_snobold_vassal::npc_snobold_vassalAI::UpdateAI(), boss_gormok::boss_gormokAI::UpdateAI(), npc_impaling_spear::npc_impaling_spearAI::UpdateAI(), boss_flame_leviathan_seat::UpdateAI(), boss_flame_leviathan_safety_container::UpdateAI(), npc_gunship::npc_gunshipAI::UpdateAI(), npc_ulduar_mimiron_rocket::UpdateAI(), npc_brunnhildar_prisoner::npc_brunnhildar_prisonerAI::UpdateAI(), Player::UpdateAreaDependentAuras(), UpdatePosition(), UpdateSpeed(), GameObject::Use(), Acore::MessageDistDeliverer::Visit(), and Acore::MessageDistDelivererToHostile::Visit().

◆ GetVehicleBase()

◆ GetVehicleCreatureBase()

◆ GetVehicleKit()

Vehicle * Unit::GetVehicleKit ( ) const
inline
1908{ return m_vehicleKit; }

References m_vehicleKit.

Referenced by _EnterVehicle(), Creature::AddToWorld(), Creature::AIM_Initialize(), boss_xt002::AttachHeart(), npc_salvaged_siege_engine::BeforeSpellClick(), boss_deathbringer_saurfang::boss_deathbringer_saurfangAI::boss_deathbringer_saurfangAI(), Object::BuildMovementUpdate(), spell_igb_cannon_blast::CalculatePower(), Aura::CanStackWith(), spell_demolisher_ride_vehicle::CheckCast(), SmartAI::CheckConditions(), VehicleAI::CheckConditions(), Map::CreatureRelocation(), MotionTransport::DelayedTeleportTransport(), Dismount(), npc_orb_carrier::npc_orb_carrierAI::DoAction(), npc_ulduar_vx001::DoAction(), npc_hover_disk::DoAction(), boss_skadi_grauf::boss_skadi_graufAI::DoAction(), Spell::EffectTeleportUnits(), CreatureAI::EnterEvadeMode(), boss_ick::boss_ickAI::GetKrick(), npc_ulduar_leviathan_mkii::GetS3(), SmartScript::GetTargets(), AuraEffect::HandleAuraControlVehicle(), AuraEffect::HandleAuraSetVehicle(), WorldSession::HandleCastSpellOpcode(), spell_q13280_13283_plant_battle_standard::HandleDummy(), WorldSession::HandleEjectPassenger(), spell_auto_repair::HandleScript(), spell_q12919_gymers_throw::HandleScript(), HandleSpellClick(), IsOnVehicle(), go_wg_vehicle_teleporter::go_wg_vehicle_teleporterAI::IsValidVehicle(), boss_gormok::boss_gormokAI::JustEngagedWith(), Mount(), npc_hover_disk::MovementInform(), npc_enslaved_proto_drake::MovementInform(), npc_vehicle_d16_propelled_delivery::npc_vehicle_d16_propelled_deliveryAI::MovementInform(), npc_high_overlord_saurfang_icc::npc_high_overlord_saurfangAI::npc_high_overlord_saurfangAI(), npc_orb_carrier::npc_orb_carrierAI::npc_orb_carrierAI(), spell_systems_shutdown_aura::OnApply(), VehicleAI::OnCharmed(), spell_blood_queen_frenzied_bloodthirst_aura::OnRemove(), FlameLeviathanPursuedTargetSelector::operator()(), OutDebugInfo(), npc_wintergarde_gryphon::PassengerBoarded(), boss_flame_leviathan_seat::PassengerBoarded(), Map::PlayerRelocation(), SmartScript::ProcessAction(), boss_skadi_grauf::boss_skadi_graufAI::RemoveSkadi(), Spell::SelectImplicitCasterObjectTargets(), SetCharmedBy(), SmartAI::SmartAI(), npc_wintergarde_gryphon::SpellHit(), npc_brunnhildar_prisoner::npc_brunnhildar_prisonerAI::SpellHit(), boss_flame_leviathan::SpellHitTarget(), npc_infra_green_bomber_generic::npc_infra_green_bomber_genericAI::SpreadFire(), boss_gormok::boss_gormokAI::UpdateAI(), npc_oculus_drake::npc_oculus_drakeAI::UpdateAI(), npc_ulduar_vx001::UpdateAI(), boss_xt002::UpdateAI(), npc_q24545_lich_king::npc_q24545_lich_kingAI::UpdateAI(), npc_infra_green_bomber_generic::npc_infra_green_bomber_genericAI::UpdateAI(), npc_freed_protodrake::npc_freed_protodrakeAI::UpdateAI(), npc_hyldsmeet_protodrake::UpdateAI(), npc_wg_siege_machine::npc_wg_siege_machineAI::UpdateAI(), UpdateHeight(), and UpdateOrientation().

◆ GetVictim()

Unit * Unit::GetVictim ( ) const
inline
897{ return m_attacking; }

References m_attacking.

Referenced by boss_marli::_chargePlayer(), PetAI::_needToStop(), npc_escortAI::AssistPlayerInCombatAgainst(), FollowerAI::AssistPlayerInCombatAgainst(), SmartAI::AssistPlayerInCombatAgainst(), Attack(), PetAI::AttackedBy(), npc_tapoke_slim_jahn::npc_tapoke_slim_jahnAI::AttackedBy(), boss_malygos::AttackStart(), npc_dark_nucleus::npc_dark_nucleusAI::AttackStart(), Object::BuildMovementUpdate(), Creature::CallAssistance(), Creature::CallForHelp(), TurretAI::CanAIAttack(), PetAI::CanAttack(), boss_attumen::CanMeleeHit(), boss_midnight::CanMeleeHit(), boss_swamplord_muselek::CanShootVictim(), Spell::CheckCast(), boss_mandokir::boss_mandokirAI::DamageDealt(), boss_isalien::DamageTaken(), boss_garfrost::boss_garfrostAI::DamageTaken(), boss_lady_deathwhisper::boss_lady_deathwhisperAI::DamageTaken(), npc_crok_scourgebane::npc_crok_scourgebaneAI::DamageTaken(), npc_ulduar_arachnopod_destroyer::DamageTaken(), npc_dark_nucleus::npc_dark_nucleusAI::DamageTaken(), boss_thorim::DamageTaken(), boss_leotheras_the_blind::DemonTime(), SmartAI::DistanceYourself(), boss_sacrolash::DoAction(), boss_alythess::DoAction(), boss_skadi::boss_skadiAI::DoAction(), UnitAI::DoCast(), UnitAI::DoCastVictim(), ConfusedMovementGenerator< T >::DoFinalize(), Creature::DoFleeToGetAssistance(), UnitAI::DoMeleeAttackIfReady(), boss_mandokir::boss_mandokirAI::DoMeleeAttackIfReady(), boss_ambassador_hellmaw::DoMeleeAttackIfReady(), UnitAI::DoSpellAttackIfReady(), ScriptedAI::DoStopAttack(), ChaseMovementGenerator< T >::DoUpdate(), Spell::EffectTaunt(), boss_ouro::Emerge(), AssistDelayEvent::Execute(), RestoreAttack::Execute(), StartMovementEvent::Execute(), boss_sartharion_tenebron::ExecuteEvent(), boss_sartharion_shadron::ExecuteEvent(), boss_sartharion_vesperon::ExecuteEvent(), emerald_dragonAI::ExecuteEvent(), spell_shazzrah_gate_dummy::FilterTargets(), spell_malchezaar_enfeeble::FilterTargets(), spell_chain_burn::FilterTargets(), spell_morogrim_tidewalker_watery_grave::FilterTargets(), TimedFleeingMovementGenerator::Finalize(), getAttackerForHelper(), ThreatMgr::GetCurrentVictim(), Player::GetInitialVisiblePackets(), CreatureGroup::GetNewTargetForMember(), SmartScript::GetTargets(), boss_blood_queen_lana_thel::boss_blood_queen_lana_thelAI::GoToMinchar(), cast_commandscript::HandleCastTargetCommad(), spell_aggro_drones::HandleDummy(), spell_gen_threshalisk_charge::HandleDummy(), spell_rog_prey_on_the_weak::HandleEffectPeriodic(), spell_lurker_below_spout::HandleEffectRemove(), spell_mirkblood_blood_mirror_target_picker::HandleHit(), AuraEffect::HandleModPossessPet(), AuraEffect::HandlePeriodicDummyAuraTick(), AuraEffect::HandlePeriodicTriggerSpellAuraTick(), WorldSession::HandlePetActionHelper(), spell_gen_overlords_brand::HandleProc(), spell_gen_overlords_brand_dot::HandleProc(), WorldSession::HandleSetRaidDifficultyOpcode(), ChaseMovementGenerator< T >::HasLostTarget(), Spell::InitExplicitTargets(), RotateMovementGenerator::Initialize(), IsMutualChase(), boss_ouro::IsPlayerWithinMeleeRange(), boss_attumen::IsSummonedBy(), npc_pet_dk_ghoul::IsSummonedBy(), npc_pet_dk_army_of_the_dead::IsSummonedBy(), boss_ragnaros::boss_ragnarosAI::IsVictimWithinMeleeRange(), npc_malchezaar_axe::JustEngagedWith(), boss_shade_of_aran::JustEngagedWith(), boss_akilzon::JustEngagedWith(), boss_zuljin::JustEngagedWith(), npc_zealot_zath::JustEngagedWith(), npc_nexus_lord::JustEngagedWith(), npc_overlord_drakuru_betrayal::JustEngagedWith(), npc_yor::JustEngagedWith(), npc_flame_of_azzinoth::JustEngagedWith(), boss_essence_of_anger::boss_essence_of_angerAI::JustEngagedWith(), boss_swamplord_muselek::JustEngagedWith(), boss_nethermancer_sepethrea::JustEngagedWith(), boss_kagani_nightstrike::JustEngagedWith(), boss_sacrolash::JustEngagedWith(), boss_alythess::JustEngagedWith(), boss_nalorakk::JustEngagedWith(), boss_vem::JustEngagedWith(), boss_veklor::JustEngagedWith(), boss_high_astromancer_solarian::JustEngagedWith(), boss_midnight::JustSummoned(), boss_nightbane::JustSummoned(), boss_halazzi::JustSummoned(), boss_lady_deathwhisper::boss_lady_deathwhisperAI::JustSummoned(), boss_fathomlord_karathress::JustSummoned(), boss_fathomguard_tidalvess::JustSummoned(), boss_the_black_stalker::JustSummoned(), boss_nethermancer_sepethrea::JustSummoned(), npc_nelson::npc_nelsonAI::JustSummoned(), npc_emily::npc_emilyAI::JustSummoned(), PetAI::KilledUnit(), boss_ick::boss_ickAI::KilledUnit(), boss_flame_leviathan::KilledUnit(), spell_svalna_revive_champion::Land(), CreatureGroup::LeaderMoveTo(), CreatureGroup::MemberEngagingTarget(), CreatureAI::MoveBackwardsChecks(), CreatureAI::MoveCircleChecks(), FollowerAI::MoveInLineOfSight(), npc_escortAI::MoveInLineOfSight(), SmartAI::MoveInLineOfSight(), npc_kerlonian::npc_kerlonianAI::MoveInLineOfSight(), npc_tooga::npc_toogaAI::MoveInLineOfSight(), npc_ringo::npc_ringoAI::MoveInLineOfSight(), boss_gluth::boss_gluthAI::MoveInLineOfSight(), npc_future_you::npc_future_youAI::MoveInLineOfSight(), npc_captain_saeed::npc_captain_saeedAI::MoveInLineOfSight(), npc_pet_hunter_snake_trap::MoveInLineOfSight(), npc_air_force_bots::npc_air_force_botsAI::MoveInLineOfSight(), boss_nightbane::MovementInform(), boss_bug_trio::MovementInform(), boss_garfrost::boss_garfrostAI::MovementInform(), boss_lady_vashj::MovementInform(), boss_nazan::MovementInform(), boss_felmyst::MovementInform(), boss_kaelthas::MovementInform(), boss_jedoga_shadowseeker::MovementInform(), boss_kagani_nightstrike::MovementInform(), boss_twin_valkyrAI::myDoMeleeAttackIfReady(), npc_pet_dk_ebon_gargoyle::MySelectNextTarget(), npc_pet_mage_mirror_image::MySelectNextTarget(), spell_malygos_vortex_visual::OnRemove(), NecroticPlagueTargetCheck::operator()(), NonTankTargetSelector::operator()(), VampiricBiteTargetSelector::operator()(), BoneStormMoveTargetSelector::operator()(), LastPhaseIceTombTargetSelector::operator()(), NonTankLKTargetSelector::operator()(), WebTargetSelector::operator()(), UnboundPlagueTargetSelector::operator()(), PetAI::OwnerAttacked(), npc_pet_gen_valkyr_guardian::OwnerAttacked(), PetAI::OwnerAttackedBy(), boss_nefarian::PathEndReached(), SmartScript::ProcessEvent(), SmartScript::ProcessEventsFor(), SmartScript::ProcessTimedAction(), boss_grobbulus::boss_grobbulusAI::PullChamberAdds(), Creature::ReleaseFocus(), boss_leotheras_the_blind::Reset(), boss_magtheridon::Reset(), npc_pet_hunter_snake_trap::Reset(), Creature::ResumeChasingVictim(), boss_high_botanist_freywinn::ResumeEncounter(), Resurrect(), boss_kiljaeden::ScheduleBasicAbilities(), npc_sunblade_scout::ScheduleCombat(), npc_amanishi_scout::ScheduleCombat(), boss_taldaram::ScheduleCombatEvents(), boss_magtheridon::ScheduleCombatEvents(), npc_thaladred::ScheduleEvents(), boss_nightbane::ScheduleFly(), boss_the_lurker_below::SchedulerPhaseOne(), npc_giant_claw_tentacle::ScheduleTasks(), boss_dred::boss_dredAI::ScheduleTasks(), SelectNearbyNoTotemTarget(), SelectNearbyTarget(), PetAI::SelectNextTarget(), SmartAI::SetCombatMovement(), SetConfused(), SmartAI::SetCurrentRangeMode(), SetFeared(), SetStunned(), boss_murmur::ShouldCastResonance(), boss_razorscale::SpellHit(), boss_quartermaster_zigris::SpellHitTarget(), boss_volkhan::SpellHitTarget(), boss_darkmaster_gandling::boss_darkmaster_gandlingAI::SpellHitTarget(), npc_escortAI::Start(), FollowerAI::StartFollow(), StopAttackFaction(), SummonCroneIfReady(), boss_akilzon::SummonEagles(), boss_drakkari_colossus::boss_drakkari_colossusAI::SummonedCreatureDespawn(), boss_dorothee::SummonTito(), TauntApply(), TauntFadeOut(), npc_daphne_stilwell::npc_daphne_stilwellAI::Update(), Pet::Update(), Creature::Update(), Player::Update(), CasterAI::UpdateAI(), ArcherAI::UpdateAI(), SimpleCharmedAI::UpdateAI(), npc_escortAI::UpdateAI(), boss_general_angerforge::boss_general_angerforgeAI::UpdateAI(), boss_gorosh_the_dervish::boss_gorosh_the_dervishAI::UpdateAI(), boss_grizzle::boss_grizzleAI::UpdateAI(), boss_hedrum::boss_hedrumAI::UpdateAI(), boss_okthor::boss_okthorAI::UpdateAI(), boss_drakkisath::boss_drakkisathAI::UpdateAI(), boss_quartermaster_zigris::UpdateAI(), npc_rookery_hatcher::npc_rookery_hatcherAI::UpdateAI(), boss_broodlord::boss_broodlordAI::UpdateAI(), boss_firemaw::boss_firemawAI::UpdateAI(), boss_flamegor::boss_flamegorAI::UpdateAI(), boss_vaelastrasz::boss_vaelAI::UpdateAI(), boss_mr_smite::boss_mr_smiteAI::UpdateAI(), npc_death_knight_initiate::npc_death_knight_initiateAI::UpdateAI(), npc_a_special_surprise::npc_a_special_surpriseAI::UpdateAI(), boss_kirtonos_the_herald::boss_kirtonos_the_heraldAI::UpdateAI(), npc_scholomance_occultist::npc_scholomance_occultistAI::UpdateAI(), npc_bh_thalorien_dawnseeker::npc_bh_thalorien_dawnseekerAI::UpdateAI(), npc_lady_sylvanas_windrunner::npc_lady_sylvanas_windrunnerAI::UpdateAI(), npc_varian_wrynn::npc_varian_wrynnAI::UpdateAI(), npc_jaina_proudmoore_bfu::npc_jaina_proudmoore_bfuAI::UpdateAI(), npc_thrall_bfu::npc_thrall_bfuAI::UpdateAI(), npc_lady_sylvanas_windrunner_bfu::npc_lady_sylvanas_windrunner_bfuAI::UpdateAI(), boss_arlokk::boss_arlokkAI::UpdateAI(), boss_hazzarah::UpdateAI(), boss_headless_horseman::UpdateAI(), boss_epoch::boss_epochAI::UpdateAI(), boss_infinite_corruptor::boss_infinite_corruptorAI::UpdateAI(), boss_mal_ganis::boss_mal_ganisAI::UpdateAI(), boss_salramm::boss_salrammAI::UpdateAI(), npc_arthas::npc_arthasAI::UpdateAI(), boss_onyxia::UpdateAI(), boss_skeram::UpdateAI(), npc_muglash::npc_muglashAI::UpdateAI(), npc_murkdeep::npc_murkdeepAI::UpdateAI(), npc_aquementas::npc_aquementasAI::UpdateAI(), npc_plucky::npc_pluckyAI::UpdateAI(), npc_weegli_blastfuse::npc_weegli_blastfuseAI::UpdateAI(), npc_shadowpriest_sezziz::npc_shadowpriest_sezzizAI::UpdateAI(), npc_twilight_summon::UpdateAI(), boss_baltharus_the_warborn::boss_baltharus_the_warbornAI::UpdateAI(), npc_baltharus_the_warborn_clone::npc_baltharus_the_warborn_cloneAI::UpdateAI(), boss_general_zarithrian::boss_general_zarithrianAI::UpdateAI(), boss_halion::boss_halionAI::UpdateAI(), boss_twilight_halion::boss_twilight_halionAI::UpdateAI(), boss_saviana_ragefire::boss_saviana_ragefireAI::UpdateAI(), npc_argent_soldier::npc_argent_soldierAI::UpdateAI(), boss_black_knight::boss_black_knightAI::UpdateAI(), npc_black_knight_ghoul::npc_black_knight_ghoulAI::UpdateAI(), npc_toc5_grand_champion_minion::npc_toc5_grand_champion_minionAI::UpdateAI(), boss_grand_champion::boss_grand_championAI::UpdateAI(), boss_anubarak_trial::boss_anubarak_trialAI::UpdateAI(), npc_nerubian_burrower::npc_nerubian_burrowerAI::UpdateAI(), npc_toc_shaman::npc_toc_shamanAI::UpdateAI(), npc_toc_shadow_priest::npc_toc_shadow_priestAI::UpdateAI(), npc_toc_warlock::npc_toc_warlockAI::UpdateAI(), npc_toc_mage::npc_toc_mageAI::UpdateAI(), npc_toc_hunter::npc_toc_hunterAI::UpdateAI(), npc_toc_boomkin::npc_toc_boomkinAI::UpdateAI(), npc_toc_warrior::npc_toc_warriorAI::UpdateAI(), npc_toc_dk::npc_toc_dkAI::UpdateAI(), npc_toc_rogue::npc_toc_rogueAI::UpdateAI(), npc_toc_pet_warlock::npc_toc_pet_warlockAI::UpdateAI(), npc_toc_pet_hunter::npc_toc_pet_hunterAI::UpdateAI(), boss_jaraxxus::boss_jaraxxusAI::UpdateAI(), npc_mistress_of_pain::npc_mistress_of_painAI::UpdateAI(), boss_gormok::boss_gormokAI::UpdateAI(), boss_jormungarAI::UpdateAI(), boss_icehowl::boss_icehowlAI::UpdateAI(), boss_twin_valkyrAI::UpdateAI(), boss_tharon_ja::boss_tharon_jaAI::UpdateAI(), boss_trollgore::boss_trollgoreAI::UpdateAI(), boss_bronjahm::boss_bronjahmAI::UpdateAI(), boss_devourer_of_souls::boss_devourer_of_soulsAI::UpdateAI(), boss_falric::boss_falricAI::UpdateAI(), boss_marwyn::boss_marwynAI::UpdateAI(), npc_phantom_mage::npc_phantom_mageAI::UpdateAI(), npc_shadowy_mercenary::npc_shadowy_mercenaryAI::UpdateAI(), npc_spectral_footman::npc_spectral_footmanAI::UpdateAI(), npc_tortured_rifleman::npc_tortured_riflemanAI::UpdateAI(), npc_hor_spiritual_reflection::npc_hor_spiritual_reflectionAI::UpdateAI(), npc_hor_risen_witch_doctor::npc_hor_risen_witch_doctorAI::UpdateAI(), npc_hor_lumbering_abomination::npc_hor_lumbering_abominationAI::UpdateAI(), boss_garfrost::boss_garfrostAI::UpdateAI(), boss_ick::boss_ickAI::UpdateAI(), boss_krick::boss_krickAI::UpdateAI(), boss_tyrannus::boss_tyrannusAI::UpdateAI(), npc_pos_deathwhisper_necrolyte::npc_pos_deathwhisper_necrolyteAI::UpdateAI(), boss_drakkari_colossus::boss_drakkari_colossusAI::UpdateAI(), npc_living_mojo::npc_living_mojoAI::UpdateAI(), boss_moorabi::boss_moorabiAI::UpdateAI(), boss_prince_taldaram_icc::boss_prince_taldaramAI::UpdateAI(), npc_dark_nucleus::npc_dark_nucleusAI::UpdateAI(), boss_blood_queen_lana_thel::boss_blood_queen_lana_thelAI::UpdateAI(), boss_festergut::boss_festergutAI::UpdateAI(), npc_stinky_icc::npc_stinky_iccAI::UpdateAI(), npc_high_overlord_saurfang_igb::npc_high_overlord_saurfang_igbAI::UpdateAI(), npc_muradin_bronzebeard_igb::npc_muradin_bronzebeard_igbAI::UpdateAI(), npc_gunship_boarding_leader::npc_gunship_boarding_leaderAI::UpdateAI(), npc_gunship_boarding_add::npc_gunship_boarding_add_realAI::UpdateAI(), npc_gunship_gunner::npc_gunship_gunnerAI::UpdateAI(), boss_lady_deathwhisper::boss_lady_deathwhisperAI::UpdateAI(), npc_cult_fanatic::npc_cult_fanaticAI::UpdateAI(), npc_cult_adherent::npc_cult_adherentAI::UpdateAI(), npc_vengeful_shade::npc_vengeful_shadeAI::UpdateAI(), npc_darnavan::npc_darnavanAI::UpdateAI(), boss_lord_marrowgar::UpdateAI(), boss_professor_putricide::boss_professor_putricideAI::UpdateAI(), npc_putricide_oozeAI::UpdateAI(), npc_little_ooze::npc_little_oozeAI::UpdateAI(), npc_big_ooze::npc_big_oozeAI::UpdateAI(), npc_precious_icc::npc_precious_iccAI::UpdateAI(), boss_sindragosa::boss_sindragosaAI::UpdateAI(), npc_spinestalker::npc_spinestalkerAI::UpdateAI(), npc_rimefang::npc_rimefangAI::UpdateAI(), npc_sindragosa_trash::npc_sindragosa_trashAI::UpdateAI(), boss_the_lich_king::boss_the_lich_kingAI::UpdateAI(), npc_shambling_horror_icc::npc_shambling_horror_iccAI::UpdateAI(), npc_icc_ice_sphere::npc_icc_ice_sphereAI::UpdateAI(), npc_raging_spirit::npc_raging_spiritAI::UpdateAI(), npc_spirit_warden::npc_spirit_wardenAI::UpdateAI(), npc_blazing_skeleton::npc_blazing_skeletonAI::UpdateAI(), npc_frostwing_vrykul::npc_frostwing_vrykulAI::UpdateAI(), npc_icc_skybreaker_hierophant::npc_icc_skybreaker_hierophantAI::UpdateAI(), npc_icc_skybreaker_marksman::npc_icc_skybreaker_marksmanAI::UpdateAI(), npc_icc_skybreaker_vicar::npc_icc_skybreaker_vicarAI::UpdateAI(), npc_icc_skybreaker_luminary::npc_icc_skybreaker_luminaryAI::UpdateAI(), npc_icc_severed_essence::npc_icc_severed_essenceAI::UpdateAI(), npc_icc_vengeful_fleshreaper::npc_icc_vengeful_fleshreaperAI::UpdateAI(), npc_icc_nerubar_broodkeeper::npc_icc_nerubar_broodkeeperAI::UpdateAI(), boss_four_horsemen::boss_four_horsemenAI::UpdateAI(), boss_gluth::boss_gluthAI::UpdateAI(), boss_gothik::boss_gothikAI::UpdateAI(), npc_boss_gothik_minion::npc_boss_gothik_minionAI::UpdateAI(), boss_grobbulus::boss_grobbulusAI::UpdateAI(), boss_kelthuzad::boss_kelthuzadAI::UpdateAI(), boss_kelthuzad_minion::boss_kelthuzad_minionAI::UpdateAI(), boss_maexxna::boss_maexxnaAI::UpdateAI(), boss_sapphiron::boss_sapphironAI::UpdateAI(), boss_thaddius_summon::boss_thaddius_summonAI::UpdateAI(), boss_malygos::UpdateAI(), npc_nexus_lord::UpdateAI(), boss_anomalus::UpdateAI(), boss_keristrasza::UpdateAI(), boss_eregos::boss_eregosAI::UpdateAI(), boss_urom::boss_uromAI::UpdateAI(), npc_stormforged_lieutenant::UpdateAI(), boss_krystallus::boss_krystallusAI::UpdateAI(), boss_maiden_of_grief::boss_maiden_of_griefAI::UpdateAI(), boss_algalon_the_observer::UpdateAI(), boss_steelbreaker::UpdateAI(), boss_stormcaller_brundir::UpdateAI(), npc_auriaya_sanctum_sentry::UpdateAI(), boss_flame_leviathan::UpdateAI(), boss_freya_elder_ironbranch::UpdateAI(), boss_freya_summons::UpdateAI(), boss_vezax::UpdateAI(), npc_ulduar_hodir_priest::UpdateAI(), npc_ulduar_hodir_druid::UpdateAI(), npc_ulduar_hodir_shaman::UpdateAI(), npc_ulduar_hodir_mage::UpdateAI(), boss_ignis::UpdateAI(), boss_kologarn::UpdateAI(), npc_ulduar_leviathan_mkii::UpdateAI(), npc_ulduar_aerial_command_unit::UpdateAI(), boss_razorscale::UpdateAI(), npc_ulduar_dark_rune_guardian::UpdateAI(), npc_ulduar_dark_rune_watcher::UpdateAI(), npc_ulduar_dark_rune_sentinel::UpdateAI(), boss_thorim::UpdateAI(), boss_thorim_start_npcs::UpdateAI(), boss_thorim_gauntlet_npcs::UpdateAI(), boss_thorim_runic_colossus::UpdateAI(), boss_thorim_ancient_rune_giant::UpdateAI(), boss_thorim_arena_npcs::UpdateAI(), npc_xt002_pummeller::UpdateAI(), npc_ulduar_storm_tempered_keeper::UpdateAI(), npc_ulduar_arachnopod_destroyer::UpdateAI(), boss_ingvar_the_plunderer::UpdateAI(), npc_vrykul_skeleton::UpdateAI(), boss_skarvald_the_constructor::UpdateAI(), boss_palehoof::boss_palehoofAI::UpdateAI(), npc_ferocious_rhino::npc_ferocious_rhinoAI::UpdateAI(), npc_ravenous_furbolg::npc_ravenous_furbolgAI::UpdateAI(), npc_frenzied_worgen::npc_frenzied_worgenAI::UpdateAI(), boss_skadi::boss_skadiAI::UpdateAI(), boss_svala::boss_svalaAI::UpdateAI(), boss_ymiron::boss_ymironAI::UpdateAI(), boss_archavon::boss_archavonAI::UpdateAI(), boss_cyanigosa::boss_cyanigosaAI::UpdateAI(), boss_erekem::boss_erekemAI::UpdateAI(), npc_erekem_guard::npc_erekem_guardAI::UpdateAI(), boss_lavanthor::boss_lavanthorAI::UpdateAI(), boss_moragg::boss_moraggAI::UpdateAI(), boss_xevozz::boss_xevozzAI::UpdateAI(), npc_azure_invader::npc_azure_invaderAI::UpdateAI(), npc_azure_raider::npc_azure_raiderAI::UpdateAI(), npc_azure_captain::npc_azure_captainAI::UpdateAI(), npc_q24545_vegard::npc_q24545_vegardAI::UpdateAI(), npc_wounded_skirmisher::UpdateAI(), npc_boneguard_footman::npc_boneguard_footmanAI::UpdateAI(), boss_gathios_the_shatterer::UpdateAI(), boss_lady_malande::UpdateAI(), boss_lady_vashj::UpdateAI(), boss_the_lurker_below::UpdateAI(), boss_omor_the_unscarred::UpdateAI(), npc_millhouse_manastorm::npc_millhouse_manastormAI::UpdateAI(), npc_nether_drake::npc_nether_drakeAI::UpdateAI(), npc_dragonmaw_peon::npc_dragonmaw_peonAI::UpdateAI(), npc_pet_dk_ebon_gargoyle::UpdateAI(), npc_pet_gen_valkyr_guardian::UpdateAI(), npc_pet_hunter_snake_trap::UpdateAI(), npc_pet_mage_mirror_image::UpdateAI(), npc_pet_shaman_fire_elemental::UpdateAI(), guard_shattrath_scryer::guard_shattrath_scryerAI::UpdateAI(), guard_shattrath_aldor::guard_shattrath_aldorAI::UpdateAI(), npc_artorius::npc_artoriusAI::UpdateAI(), npc_simone::npc_simoneAI::UpdateAI(), npc_nelson::npc_nelsonAI::UpdateAI(), npc_franklin::npc_franklinAI::UpdateAI(), PossessedAI::UpdateAI(), PetAI::UpdateAI(), FollowerAI::UpdateAI(), npc_dark_fiend::UpdateAI(), npc_zuljin_vortex::UpdateAI(), npc_suppresser::npc_suppresserAI::UpdateAI(), npc_xt002_life_spark::UpdateAI(), boss_yoggsaron_crusher_tentacle::UpdateAI(), npc_pet_gen_gnomish_flame_turret::UpdateAI(), Player::UpdateCharmedAI(), npc_thrall_old_hillsbrad::npc_thrall_old_hillsbradAI::UpdateEscortAI(), npc_isla_starmane::npc_isla_starmaneAI::UpdateEscortAI(), Player::UpdateFFAPvPFlag(), Player::UpdateFFAPvPState(), SmartAI::UpdatePath(), boss_netherspite::UpdatePortals(), CreatureAI::UpdateVictim(), CreatureAI::UpdateVictimWithGaze(), boss_hexlord_malacrass::UseAbility(), and instance_eye_of_eternity::VortexHandling().

◆ GetVirtualItemId()

uint32 Unit::GetVirtualItemId ( uint32  slot) const
17379{
17380 if (slot >= MAX_EQUIPMENT_ITEMS)
17381 return 0;
17382
17384}
#define MAX_EQUIPMENT_ITEMS
Definition CreatureData.h:35
@ UNIT_VIRTUAL_ITEM_SLOT_ID
Definition UpdateFields.h:116

References Object::GetUInt32Value(), MAX_EQUIPMENT_ITEMS, and UNIT_VIRTUAL_ITEM_SLOT_ID.

◆ GetVisibleAura()

AuraApplication * Unit::GetVisibleAura ( uint8  slot)
inline
1530 {
1531 VisibleAuraMap::iterator itr = m_visibleAuras.find(slot);
1532 if (itr != m_visibleAuras.end())
1533 return itr->second;
1534 return nullptr;
1535 }

References m_visibleAuras.

Referenced by WorldSession::BuildPartyMemberStatsChangedPacket(), AuraApplication::BuildUpdatePacket(), and WorldSession::HandleRequestPartyMemberStatsOpcode().

◆ GetVisibleAuras()

◆ GetWeaponDamageRange()

float Unit::GetWeaponDamageRange ( WeaponAttackType  attType,
WeaponDamageRange  type,
uint8  damageIndex = 0 
) const
12463{
12464 if (attType == OFF_ATTACK && !HasOffhandWeaponForAttack())
12465 return 0.0f;
12466
12467 return m_weaponDamage[attType][type][damageIndex];
12468}

References HasOffhandWeaponForAttack(), m_weaponDamage, and OFF_ATTACK.

Referenced by Player::_ApplyWeaponDamage(), Creature::CalculateMinMaxDamage(), Player::CalculateMinMaxDamage(), and Guardian::UpdateDamagePhysical().

◆ GetWeaponProcChance()

float Unit::GetWeaponProcChance ( ) const
10365{
10366 // normalized proc chance for weapon attack speed
10367 // (odd formula...)
10369 return (GetAttackTime(BASE_ATTACK) * 1.8f / 1000.0f);
10371 return (GetAttackTime(OFF_ATTACK) * 1.6f / 1000.0f);
10372 return 0;
10373}

References BASE_ATTACK, GetAttackTime(), HasOffhandWeaponForAttack(), isAttackReady(), and OFF_ATTACK.

Referenced by Player::CastItemCombatSpell().

◆ GetWeaponSkillValue()

uint32 Unit::GetWeaponSkillValue ( WeaponAttackType  attType,
Unit const *  target = nullptr 
) const
3908{
3909 uint32 value = 0;
3910 if (Player const* player = ToPlayer())
3911 {
3912 Item* item = player->GetWeaponForAttack(attType, true);
3913
3914 // feral or unarmed skill only for base attack
3915 if (attType != BASE_ATTACK && !item)
3916 return 0;
3917
3918 if (IsInFeralForm())
3919 return GetMaxSkillValueForLevel(); // always maximized SKILL_FERAL_COMBAT in fact
3920
3921 // weapon skill or (unarmed for base attack)
3922 uint32 skill = SKILL_UNARMED;
3923 if (item)
3924 skill = item->GetSkill();
3925
3926 // in PvP use full skill instead current skill value
3927 value = (target && target->IsControlledByPlayer())
3928 ? player->GetMaxSkillValue(skill)
3929 : player->GetSkillValue(skill);
3930 // Modify value from ratings
3931 value += uint32(player->GetRatingBonusValue(CR_WEAPON_SKILL));
3932 switch (attType)
3933 {
3934 case BASE_ATTACK:
3935 value += uint32(player->GetRatingBonusValue(CR_WEAPON_SKILL_MAINHAND));
3936 break;
3937 case OFF_ATTACK:
3938 value += uint32(player->GetRatingBonusValue(CR_WEAPON_SKILL_OFFHAND));
3939 break;
3940 case RANGED_ATTACK:
3941 value += uint32(player->GetRatingBonusValue(CR_WEAPON_SKILL_RANGED));
3942 break;
3943 default:
3944 break;
3945 }
3946 }
3947 else
3948 value = GetUnitMeleeSkill(target);
3949 return value;
3950}
@ SKILL_UNARMED
Definition SharedDefines.h:3147
@ CR_WEAPON_SKILL_RANGED
Definition Unit.h:246
@ CR_WEAPON_SKILL
Definition Unit.h:224
@ CR_WEAPON_SKILL_OFFHAND
Definition Unit.h:245
@ CR_WEAPON_SKILL_MAINHAND
Definition Unit.h:244
uint32 GetSkill()
Definition Item.cpp:555
bool IsInFeralForm() const
Definition Unit.h:1943

References BASE_ATTACK, CR_WEAPON_SKILL, CR_WEAPON_SKILL_MAINHAND, CR_WEAPON_SKILL_OFFHAND, CR_WEAPON_SKILL_RANGED, GetMaxSkillValueForLevel(), Item::GetSkill(), GetUnitMeleeSkill(), IsControlledByPlayer(), IsInFeralForm(), OFF_ATTACK, RANGED_ATTACK, SKILL_UNARMED, and Object::ToPlayer().

Referenced by isSpellBlocked(), MeleeSpellHitResult(), RollMeleeOutcomeAgainst(), RollMeleeOutcomeAgainst(), and Player::UpdateCritPercentage().

◆ HandleAuraRaidProcFromCharge()

bool Unit::HandleAuraRaidProcFromCharge ( AuraEffect triggeredByAura)
private
14027{
14028 // aura can be deleted at casts
14029 SpellInfo const* spellProto = triggeredByAura->GetSpellInfo();
14030
14031 uint32 damageSpellId;
14032 switch (spellProto->Id)
14033 {
14034 case 57949: // shiver
14035 damageSpellId = 57952;
14036 //animationSpellId = 57951; dummy effects for jump spell have unknown use (see also 41637)
14037 break;
14038 case 59978: // shiver
14039 damageSpellId = 59979;
14040 break;
14041 case 43593: // Cold Stare
14042 damageSpellId = 43594;
14043 break;
14044 default:
14045 LOG_ERROR("entities.unit", "Unit::HandleAuraRaidProcFromCharge, received unhandled spell: {}", spellProto->Id);
14046 return false;
14047 }
14048
14049 ObjectGuid caster_guid = triggeredByAura->GetCasterGUID();
14050
14051 // jumps
14052 int32 jumps = triggeredByAura->GetBase()->GetCharges() - 1;
14053
14054 // current aura expire
14055 triggeredByAura->GetBase()->SetCharges(1); // will removed at next charges decrease
14056
14057 // next target selection
14058 if (jumps > 0)
14059 {
14060 if (Unit* caster = triggeredByAura->GetCaster())
14061 {
14062 float radius = triggeredByAura->GetSpellInfo()->Effects[triggeredByAura->GetEffIndex()].CalcRadius(caster);
14063 if (Unit* target = GetNextRandomRaidMemberOrPet(radius))
14064 {
14065 CastSpell(target, spellProto, true, nullptr, triggeredByAura, caster_guid);
14066 if (Aura* aura = target->GetAura(spellProto->Id, caster->GetGUID()))
14067 aura->SetCharges(jumps);
14068 }
14069 }
14070 }
14071
14072 CastSpell(this, damageSpellId, true, nullptr, triggeredByAura, caster_guid);
14073
14074 return true;
14075}
void SetCharges(uint8 charges)
Definition SpellAuras.cpp:894
Unit * GetNextRandomRaidMemberOrPet(float radius)
Definition Unit.cpp:8109

References CastSpell(), SpellInfo::Effects, AuraEffect::GetBase(), AuraEffect::GetCaster(), AuraEffect::GetCasterGUID(), Aura::GetCharges(), AuraEffect::GetEffIndex(), GetNextRandomRaidMemberOrPet(), AuraEffect::GetSpellInfo(), SpellInfo::Id, LOG_ERROR, and Aura::SetCharges().

◆ HandleAuraRaidProcFromChargeWithValue()

bool Unit::HandleAuraRaidProcFromChargeWithValue ( AuraEffect triggeredByAura)
private
13938{
13939 // aura can be deleted at casts
13940 SpellInfo const* spellProto = triggeredByAura->GetSpellInfo();
13941 int32 heal = triggeredByAura->GetAmount();
13942 ObjectGuid caster_guid = triggeredByAura->GetCasterGUID();
13943
13944 // Currently only Prayer of Mending
13945 if (!(spellProto->SpellFamilyName == SPELLFAMILY_PRIEST && spellProto->SpellFamilyFlags[1] & 0x20))
13946 {
13947 LOG_DEBUG("spells.aura", "Unit::HandleAuraRaidProcFromChargeWithValue, received not handled spell: {}", spellProto->Id);
13948 return false;
13949 }
13950
13951 // jumps
13952 int32 jumps = triggeredByAura->GetBase()->GetCharges() - 1;
13953
13954 // current aura expire
13955 triggeredByAura->GetBase()->SetCharges(1); // will removed at next charges decrease
13956
13957 // next target selection
13958 if (jumps > 0)
13959 {
13960 if (Unit* caster = triggeredByAura->GetCaster())
13961 {
13962 // smart healing
13963 float radius = triggeredByAura->GetSpellInfo()->Effects[triggeredByAura->GetEffIndex()].CalcRadius(caster);
13964 std::list<Unit*> nearMembers;
13965
13966 Player* player = nullptr;
13967 if (IsPlayer())
13968 player = ToPlayer();
13969 else if (GetOwner())
13970 player = GetOwner()->ToPlayer();
13971
13972 if (player)
13973 {
13974 Group* group = player->GetGroup();
13975 if (!group)
13976 {
13977 if (player != this)
13978 {
13979 if (IsWithinDistInMap(player, radius))
13980 nearMembers.push_back(player);
13981 }
13982 else if (Unit* pet = GetGuardianPet())
13983 {
13984 if (IsWithinDistInMap(pet, radius))
13985 nearMembers.push_back(pet);
13986 }
13987 }
13988 else
13989 {
13990 for (GroupReference* itr = group->GetFirstMember(); itr != nullptr; itr = itr->next())
13991 if (Player* Target = itr->GetSource())
13992 {
13993 if (Target != this && !IsWithinDistInMap(Target, radius))
13994 continue;
13995
13996 // IsHostileTo check duel and controlled by enemy
13997 if (Target != this && Target->IsAlive() && !IsHostileTo(Target))
13998 nearMembers.push_back(Target);
13999
14000 // Push player's pet to vector
14001 if (Unit* pet = Target->GetGuardianPet())
14002 if (pet != this && pet->IsAlive() && IsWithinDistInMap(pet, radius) && !IsHostileTo(pet))
14003 nearMembers.push_back(pet);
14004 }
14005 }
14006
14007 if (!nearMembers.empty())
14008 {
14009 nearMembers.sort(Acore::HealthPctOrderPred());
14010 if (Unit* target = nearMembers.front())
14011 {
14012 CastSpell(target, 41637 /*Dummy visual effect triggered by main spell cast*/, true);
14013 CastCustomSpell(target, spellProto->Id, &heal, nullptr, nullptr, true, nullptr, triggeredByAura, caster_guid);
14014 if (Aura* aura = target->GetAura(spellProto->Id, caster->GetGUID()))
14015 aura->SetCharges(jumps);
14016 }
14017 }
14018 }
14019 }
14020 }
14021
14022 // heal
14023 CastCustomSpell(this, 33110, &heal, nullptr, nullptr, true, nullptr, nullptr, caster_guid);
14024 return true;
14025}
@ SPELLFAMILY_PRIEST
Definition SharedDefines.h:3790
Definition Unit.h:2277

References CastCustomSpell(), CastSpell(), SpellInfo::Effects, AuraEffect::GetAmount(), AuraEffect::GetBase(), AuraEffect::GetCaster(), AuraEffect::GetCasterGUID(), Aura::GetCharges(), AuraEffect::GetEffIndex(), Group::GetFirstMember(), Player::GetGroup(), GetGuardianPet(), GetOwner(), AuraEffect::GetSpellInfo(), SpellInfo::Id, IsHostileTo(), Object::IsPlayer(), WorldObject::IsWithinDistInMap(), LOG_DEBUG, Aura::SetCharges(), SPELLFAMILY_PRIEST, SpellInfo::SpellFamilyFlags, SpellInfo::SpellFamilyName, and Object::ToPlayer().

◆ HandleEmoteCommand()

void Unit::HandleEmoteCommand ( uint32  emoteId)
2125{
2127 packet.EmoteID = emoteId;
2128 packet.Guid = GetGUID();
2129 SendMessageToSet(packet.Write(), true);
2130}
Definition ChatPackets.h:29
WorldPacket const * Write() override
Definition ChatPackets.cpp:20
uint32 EmoteID
Definition ChatPackets.h:35
ObjectGuid Guid
Definition ChatPackets.h:36

References WorldPackets::Chat::Emote::EmoteID, Object::GetGUID(), WorldPackets::Chat::Emote::Guid, WorldObject::SendMessageToSet(), and WorldPackets::Chat::Emote::Write().

Referenced by npc_ulduar_vx001::DamageTaken(), boss_viscidus::DamageTaken(), DealMeleeDamage(), boss_twinemperorsAI::DoAction(), npc_thrall_warchief::npc_thrall_warchiefAI::DoAction(), boss_razuvious_minion::boss_razuvious_minionAI::DoAction(), boss_felblood_kaelthas::DoAction(), boss_kalecgos::DoAction(), boss_yoggsaron::DoAction(), boss_illidan_stormrage::DoAction(), npc_akama_illidan::DoAction(), npc_taskmaster_fizzule::npc_taskmaster_fizzuleAI::DoFriend(), StandUpEvent::Execute(), PartyTimeEmoteEvent::Execute(), npc_anachronos_the_ancient::npc_anachronos_the_ancientAI::HandleAnimation(), npc_torloth_the_magnificent::npc_torloth_the_magnificentAI::HandleAnimation(), boss_ragnaros::boss_ragnarosAI::HandleEmerge(), WorldSession::HandleEmoteOpcode(), spell_chapter5_return_to_capital::HandleHit(), npc_commandscript::HandleNpcSayCommand(), npc_commandscript::HandleNpcYellCommand(), WorldSession::HandleTextEmoteOpcode(), npc_maiev_illidan::IsSummonedBy(), npc_akama_illidan::JustReachedHome(), npc_highlord_darion_mograine::npc_highlord_darion_mograineAI::JustSummoned(), boss_the_lich_king::boss_the_lich_kingAI::JustSummoned(), npc_sentinel_leader::MovementInform(), npc_sentinel_infiltrator::MovementInform(), npc_fos_leader_second::npc_fos_leader_secondAI::MovementInform(), boss_illidan_stormrage::MovementInform(), npc_akama_illidan::MovementInform(), npc_mature_netherwing_drake::npc_mature_netherwing_drakeAI::MovementInform(), boss_felmyst::MovementInform(), npc_dragonmaw_peon::npc_dragonmaw_peonAI::MovementInform(), boss_nightbane::PathEndReached(), boss_nefarian::PathEndReached(), spell_gen_spectator_cheer_trigger::PrepareSpellScript(), npc_dancing_flames::npc_dancing_flamesAI::ReceiveEmote(), PetAI::ReceiveEmote(), npc_plucky::npc_pluckyAI::ReceiveEmote(), boss_ragnaros::boss_ragnarosAI::Reset(), boss_thekal::Reset(), npc_zealot_lorkhan::Reset(), npc_zealot_zath::Reset(), boss_razuvious_minion::boss_razuvious_minionAI::ScheduleAttackDummy(), boss_felmyst::ScheduleGroundAbilities(), boss_razuvious::boss_razuviousAI::ScheduleInteractWithDeathKnight(), CreatureTextMgr::SendEmote(), boss_grand_warlock_nethekurse::SetData(), npc_harrison_jones::SpellHit(), npc_rabid_thistle_bear::npc_rabid_thistle_bearAI::SpellHit(), npc_wounded_skirmisher::SpellHit(), boss_felmyst::StartIntro(), boss_ahune::Submerge(), boss_nightbane::TriggerHealthTakeOff(), instance_stratholme::instance_stratholme_InstanceMapScript::Update(), boss_rend_blackhand::boss_rend_blackhandAI::UpdateAI(), boss_vaelastrasz::boss_vaelAI::UpdateAI(), npc_valkyr_battle_maiden::npc_valkyr_battle_maidenAI::UpdateAI(), boss_kirtonos_the_herald::boss_kirtonos_the_heraldAI::UpdateAI(), npc_madrigosa::UpdateAI(), npc_partygoer_pather::UpdateAI(), npc_partygoer::UpdateAI(), npc_sentinel_leader::UpdateAI(), npc_sentinel_infiltrator::UpdateAI(), npc_bh_thalorien_dawnseeker::npc_bh_thalorien_dawnseekerAI::UpdateAI(), npc_lady_sylvanas_windrunner::npc_lady_sylvanas_windrunnerAI::UpdateAI(), npc_thrall_bfu::npc_thrall_bfuAI::UpdateAI(), npc_forest_frog::UpdateAI(), npc_winterfin_playmate::UpdateAI(), npc_thrall_old_hillsbrad::npc_thrall_old_hillsbradAI::UpdateAI(), npc_shenthul::npc_shenthulAI::UpdateAI(), npc_twiggy_flathead::npc_twiggy_flatheadAI::UpdateAI(), boss_icehowl::boss_icehowlAI::UpdateAI(), npc_hor_leader::npc_hor_leaderAI::UpdateAI(), npc_tirion_fordring_tft::npc_tirion_fordringAI::UpdateAI(), npc_highlord_tirion_fordring_lh::npc_highlord_tirion_fordringAI::UpdateAI(), boss_sapphiron::boss_sapphironAI::UpdateAI(), boss_malygos::UpdateAI(), boss_mimiron::UpdateAI(), npc_valiance_keep_cannoneer::npc_valiance_keep_cannoneerAI::UpdateAI(), npc_minigob_manabonk::UpdateAI(), npc_dragonmaw_peon::npc_dragonmaw_peonAI::UpdateAI(), npc_artorius::npc_artoriusAI::UpdateAI(), npc_simone::npc_simoneAI::UpdateAI(), npc_nelson::npc_nelsonAI::UpdateAI(), npc_franklin::npc_franklinAI::UpdateAI(), npc_dancing_flames::npc_dancing_flamesAI::UpdateAI(), npc_maxx_a_million_escort::npc_maxx_a_million_escortAI::UpdateAI(), npc_rocknot::npc_rocknotAI::WaypointReached(), npc_daphne_stilwell::npc_daphne_stilwellAI::WaypointReached(), npc_thrall_old_hillsbrad::npc_thrall_old_hillsbradAI::WaypointReached(), npc_taretha::npc_tarethaAI::WaypointReached(), npc_general_andorov::WaypointReached(), npc_mootoo_the_younger::npc_mootoo_the_youngerAI::WaypointReached(), npc_engineer_helice::npc_engineer_heliceAI::WaypointReached(), npc_maxx_a_million_escort::npc_maxx_a_million_escortAI::WaypointReached(), and npc_isla_starmane::npc_isla_starmaneAI::WaypointReached().

◆ HandleProcExtraAttackFor()

void Unit::HandleProcExtraAttackFor ( Unit victim,
uint32  count 
)
2889{
2890 while (count)
2891 {
2892 --count;
2893 AttackerStateUpdate(victim, BASE_ATTACK, true);
2894 }
2895}
void AttackerStateUpdate(Unit *victim, WeaponAttackType attType=BASE_ATTACK, bool extra=false, bool ignoreCasting=false)
Definition Unit.cpp:2695

References AttackerStateUpdate(), and BASE_ATTACK.

Referenced by Update().

◆ HandleSafeUnitPointersOnDelete()

void Unit::HandleSafeUnitPointersOnDelete ( Unit thisUnit)
static
4482{
4483 if (thisUnit->SafeUnitPointerSet.empty())
4484 return;
4485 for (std::set<SafeUnitPointer*>::iterator itr = thisUnit->SafeUnitPointerSet.begin(); itr != thisUnit->SafeUnitPointerSet.end(); ++itr)
4486 (*itr)->UnitDeleted();
4487
4488 thisUnit->SafeUnitPointerSet.clear();
4489}

References SafeUnitPointerSet.

Referenced by ~Unit().

◆ HandleSpellClick()

bool Unit::HandleSpellClick ( Unit clicker,
int8  seatId = -1 
)

First check simple relations from clicker to clickee

Check database conditions

15652{
15653 Creature* creature = ToCreature();
15654 if (creature && creature->IsAIEnabled)
15655 {
15656 if (!creature->AI()->BeforeSpellClick(clicker))
15657 {
15658 return false;
15659 }
15660 }
15661
15662 bool result = false;
15663 uint32 spellClickEntry = GetVehicleKit() ? GetVehicleKit()->GetCreatureEntry() : GetEntry();
15664 SpellClickInfoMapBounds clickPair = sObjectMgr->GetSpellClickInfoMapBounds(spellClickEntry);
15665 for (SpellClickInfoContainer::const_iterator itr = clickPair.first; itr != clickPair.second; ++itr)
15666 {
15668 if (!itr->second.IsFitToRequirements(clicker, this))
15669 continue;
15670
15672 ConditionList conds = sConditionMgr->GetConditionsForSpellClickEvent(spellClickEntry, itr->second.spellId);
15673 ConditionSourceInfo info = ConditionSourceInfo(clicker, this);
15674 if (!sConditionMgr->IsObjectMeetToConditions(info, conds))
15675 continue;
15676
15677 Unit* caster = (itr->second.castFlags & NPC_CLICK_CAST_CASTER_CLICKER) ? clicker : this;
15678 Unit* target = (itr->second.castFlags & NPC_CLICK_CAST_TARGET_CLICKER) ? clicker : this;
15679 ObjectGuid origCasterGUID = (itr->second.castFlags & NPC_CLICK_CAST_ORIG_CASTER_OWNER) ? GetOwnerGUID() : clicker->GetGUID();
15680
15681 SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(itr->second.spellId);
15682
15683 // xinef: dont allow players to enter vehicles on arena
15684 if (spellInfo->HasAura(SPELL_AURA_CONTROL_VEHICLE) && caster->IsPlayer() && caster->FindMap() && caster->FindMap()->IsBattleArena())
15685 continue;
15686
15687 if (seatId > -1)
15688 {
15689 uint8 i = 0;
15690 bool valid = false;
15691 while (i < MAX_SPELL_EFFECTS)
15692 {
15693 if (spellInfo->Effects[i].ApplyAuraName == SPELL_AURA_CONTROL_VEHICLE)
15694 {
15695 valid = true;
15696 break;
15697 }
15698 ++i;
15699 }
15700
15701 if (!valid)
15702 {
15703 LOG_ERROR("sql.sql", "Spell {} specified in npc_spellclick_spells is not a valid vehicle enter aura!", itr->second.spellId);
15704 continue;
15705 }
15706
15707 if (IsInMap(caster))
15708 caster->CastCustomSpell(itr->second.spellId, SpellValueMod(SPELLVALUE_BASE_POINT0 + i), seatId + 1, target, GetVehicleKit() ? TRIGGERED_IGNORE_CASTER_MOUNTED_OR_ON_VEHICLE : TRIGGERED_NONE, nullptr, nullptr, origCasterGUID);
15709 else // This can happen during Player::_LoadAuras
15710 {
15712 for (uint32 j = 0; j < MAX_SPELL_EFFECTS; ++j)
15713 bp0[j] = spellInfo->Effects[j].BasePoints;
15714
15715 bp0[i] = seatId;
15716 Aura::TryRefreshStackOrCreate(spellInfo, MAX_EFFECT_MASK, this, clicker, bp0, nullptr, origCasterGUID);
15717 }
15718 }
15719 else
15720 {
15721 if (IsInMap(caster))
15722 caster->CastSpell(target, spellInfo, GetVehicleKit() ? TRIGGERED_IGNORE_CASTER_MOUNTED_OR_ON_VEHICLE : TRIGGERED_NONE, nullptr, nullptr, origCasterGUID);
15723 else
15724 Aura::TryRefreshStackOrCreate(spellInfo, MAX_EFFECT_MASK, this, clicker, nullptr, nullptr, origCasterGUID);
15725 }
15726
15727 result = true;
15728 }
15729
15730 if (creature && creature->IsAIEnabled)
15731 creature->AI()->OnSpellClick(clicker, result);
15732
15733 return result;
15734}
#define sConditionMgr
Definition ConditionMgr.h:292
std::list< Condition * > ConditionList
Definition ConditionMgr.h:239
std::pair< SpellClickInfoContainer::const_iterator, SpellClickInfoContainer::const_iterator > SpellClickInfoMapBounds
Definition ObjectMgr.h:409
@ NPC_CLICK_CAST_TARGET_CLICKER
Definition SharedDefines.h:702
@ NPC_CLICK_CAST_ORIG_CASTER_OWNER
Definition SharedDefines.h:703
@ NPC_CLICK_CAST_CASTER_CLICKER
Definition SharedDefines.h:701
SpellValueMod
Definition SpellDefines.h:112
virtual void OnSpellClick(Unit *, bool &)
Definition CreatureAI.h:207
virtual bool BeforeSpellClick(Unit *)
Definition CreatureAI.h:205
bool IsBattleArena() const
Definition Map.h:302
bool HasAura(AuraType aura) const
Definition SpellInfo.cpp:893
uint32 GetCreatureEntry() const
Definition Vehicle.h:39
Map * FindMap() const
Definition Object.h:621
Definition ConditionMgr.h:184

References Creature::AI(), CreatureAI::BeforeSpellClick(), CastCustomSpell(), CastSpell(), SpellInfo::Effects, WorldObject::FindMap(), Vehicle::GetCreatureEntry(), Object::GetEntry(), Object::GetGUID(), GetOwnerGUID(), GetVehicleKit(), SpellInfo::HasAura(), IsAIEnabled, Map::IsBattleArena(), WorldObject::IsInMap(), Object::IsPlayer(), LOG_ERROR, MAX_EFFECT_MASK, MAX_SPELL_EFFECTS, NPC_CLICK_CAST_CASTER_CLICKER, NPC_CLICK_CAST_ORIG_CASTER_OWNER, NPC_CLICK_CAST_TARGET_CLICKER, CreatureAI::OnSpellClick(), sConditionMgr, sObjectMgr, SPELL_AURA_CONTROL_VEHICLE, SPELLVALUE_BASE_POINT0, sSpellMgr, Object::ToCreature(), TRIGGERED_IGNORE_CASTER_MOUNTED_OR_ON_VEHICLE, TRIGGERED_NONE, and Aura::TryRefreshStackOrCreate().

Referenced by boss_xt002::AttachHeart(), boss_kologarn::AttachLeftArm(), boss_kologarn::AttachRightArm(), WorldSession::HandleSpellClick(), Vehicle::InstallAccessory(), and npc_ulduar_vx001::UpdateAI().

◆ HandleStatFlatModifier()

bool Unit::HandleStatFlatModifier ( UnitMods  unitMod,
UnitModifierFlatType  modifierType,
float  amount,
bool  apply 
)
12089{
12090 if (unitMod >= UNIT_MOD_END || modifierType >= MODIFIER_TYPE_FLAT_END)
12091 {
12092 LOG_ERROR("entities.unit", "ERROR in HandleStatModifier(): non-existing UnitMods or wrong UnitModifierType!");
12093 return false;
12094 }
12095
12096 if (!amount)
12097 return false;
12098
12099 switch (modifierType)
12100 {
12101 case BASE_VALUE:
12102 case TOTAL_VALUE:
12103 m_auraFlatModifiersGroup[unitMod][modifierType] += apply ? amount : -amount;
12104 break;
12105 default:
12106 break;
12107 }
12108
12109 UpdateUnitMod(unitMod);
12110 return true;
12111}
void apply(T *val)
Definition ByteConverter.h:40

References BASE_VALUE, LOG_ERROR, m_auraFlatModifiersGroup, MODIFIER_TYPE_FLAT_END, TOTAL_VALUE, UNIT_MOD_END, and UpdateUnitMod().

Referenced by Player::_ApplyItemBonuses(), Player::ApplyEnchantment(), AuraEffect::HandleAuraModAttackPower(), AuraEffect::HandleAuraModIncreaseEnergy(), AuraEffect::HandleAuraModIncreaseHealth(), AuraEffect::HandleAuraModIncreaseMaxHealth(), AuraEffect::HandleAuraModRangedAttackPower(), AuraEffect::HandleAuraModResistance(), AuraEffect::HandleAuraModResistanceExclusive(), AuraEffect::HandleAuraModStat(), AuraEffect::HandleModBaseResistance(), and Player::UpdateDamageDoneMods().

◆ HasActivePowerType()

◆ HasAllAuras()

template<typename... Auras>
bool Unit::HasAllAuras ( Auras...  spellIds) const
inline

Checks if the unit has ALL specified auras.

Template Parameters
AurasCan be any type convertible to uint32.
Parameters
spellIdsList of spell id's to check for on the unit.
Returns
Returns true if the unit has ALL of the specified auras. Otherwise false.
1477 {
1478 std::vector<uint32> spellList = { static_cast<uint32>(spellIds)... };
1479 return HasAuras(SearchMethod::MatchAll, spellList);
1480 }
bool HasAuras(SearchMethod sm, std::vector< uint32 > &spellIds) const
Check if unit has ANY or ALL specified auras.
Definition Unit.cpp:5923

References HasAuras(), and MatchAll.

Referenced by achievement_staying_buffed_all_winter_10::OnCheck(), achievement_staying_buffed_all_winter_25::OnCheck(), npc_alchemist_adrianna::OnGossipHello(), and npc_nelson::npc_nelsonAI::SpellHit().

◆ HasAllowOnlyAbilityAura()

bool Unit::HasAllowOnlyAbilityAura ( ) const
inline
@ SPELL_AURA_ALLOW_ONLY_ABILITY
Definition SpellAuraDefines.h:326
bool HasAuraType(AuraType auraType) const
Definition Unit.cpp:5953

References HasAuraType(), and SPELL_AURA_ALLOW_ONLY_ABILITY.

Referenced by AuraEffect::HandleAuraAllowOnlyAbility().

◆ HasAnyAuras()

template<typename... Auras>
bool Unit::HasAnyAuras ( Auras...  spellIds) const
inline

◆ HasAOECharmAura()

bool Unit::HasAOECharmAura ( ) const
inline
@ SPELL_AURA_AOE_CHARM
Definition SpellAuraDefines.h:240

References HasAuraType(), and SPELL_AURA_AOE_CHARM.

◆ HasAttackerSpellCritChanceAura()

bool Unit::HasAttackerSpellCritChanceAura ( ) const
inline
@ SPELL_AURA_MOD_ATTACKER_SPELL_CRIT_CHANCE
Definition SpellAuraDefines.h:242

References HasAuraType(), and SPELL_AURA_MOD_ATTACKER_SPELL_CRIT_CHANCE.

Referenced by SpellTakenCritChance().

◆ HasAura()

bool Unit::HasAura ( uint32  spellId,
ObjectGuid  casterGUID = ObjectGuid::Empty,
ObjectGuid  itemCasterGUID = ObjectGuid::Empty,
uint8  reqEffMask = 0 
) const
5947{
5948 if (GetAuraApplication(spellId, casterGUID, itemCasterGUID, reqEffMask))
5949 return true;
5950 return false;
5951}

References GetAuraApplication().

Referenced by at_hol_hall_of_watchers::_OnTrigger(), boss_grand_champion::boss_grand_championAI::AddCreatureAddonAuras(), Pet::AddToWorld(), spell_warl_health_funnel::ApplyEffect(), Player::ApplyItemDependentAuras(), Player::ApplyItemObtainSpells(), boss_archavon::boss_archavonAI::AttackStart(), boss_emalon::boss_emalonAI::AttackStart(), boss_koralon::boss_koralonAI::AttackStart(), boss_toravon::boss_toravonAI::AttackStart(), boss_leotheras_the_blind::AttackStart(), npc_toc5_player_vehicle::npc_toc5_player_vehicleAI::BeforeSpellClick(), boss_hodir::CanAIAttack(), boss_hazzarah::CanAIAttack(), boss_renataki::boss_renatakiAI::CanAIAttack(), boss_chromaggus::boss_chromaggusAI::CanAIAttack(), npc_parasitic_shadowfiend::CanAIAttack(), npc_wg_siege_machine::npc_wg_siege_machineAI::CanControlVehicle(), Player::CanJoinToBattleground(), Player::CanResummonPet(), Player::CanUseAmmo(), Player::CanUseBattlegroundObject(), Player::CastItemCombatSpell(), spell_pal_aura_mastery_immune::CheckAreaTarget(), spell_q12237_rescue_villager::CheckCast(), spell_hun_pet_heart_of_the_phoenix::CheckCast(), spell_pal_immunities::CheckCast(), Spell::CheckCast(), Spell::CheckCasterAuras(), Spell::CheckItems(), spell_dru_eclipse::CheckProc(), spell_hun_lock_and_load::CheckProc(), spell_mage_gen_extra_effects::CheckProc(), spell_pal_hand_of_sacrifice::CheckTarget(), SpellInfo::CheckTarget(), npc_jenny::DamageTaken(), npc_mc_core_hound::npc_mc_core_houndAI::DamageTaken(), boss_sartharion::DamageTaken(), npc_high_overlord_saurfang_igb::npc_high_overlord_saurfang_igbAI::DamageTaken(), npc_muradin_bronzebeard_igb::npc_muradin_bronzebeard_igbAI::DamageTaken(), boss_thekal::DamageTaken(), boss_tenris_mirkblood::DamageTaken(), boss_anub_arak::DamageTaken(), boss_razorscale::DamageTaken(), boss_thorim::DamageTaken(), npc_kinetic_bomb::npc_kinetic_bombAI::DoAction(), boss_kalecgos::DoAction(), boss_illidan_stormrage::DoAction(), npc_midsummer_ribbon_pole_target::DoCleanupChecks(), Spell::DoCreateItem(), Spell::EffectDummy(), Spell::EffectHeal(), Spell::EffectInstaKill(), Spell::EffectSchoolDMG(), Spell::EffectScriptEffect(), Spell::EffectSummonPlayer(), Spell::EffectTriggerSpell(), Spell::EffectWeaponDmg(), NPCStaveQuestAI::EvadeOnFeignDeath(), IceTombSummonEvent::Execute(), PartyTimeEmoteEvent::Execute(), spell_class_call_polymorph::FilterTargets(), spell_dru_wild_growth::FilterTargets(), spell_pri_circle_of_healing::FilterTargets(), Spell::finish(), lfg::LFGMgr::FinishDungeon(), GetDispellableAuraList(), Player::GetResurrectionSpellId(), go_wind_stone::go_wind_stoneAI::GossipHello(), go_soulwell::go_soulwellAI::GossipHello(), spell_braziers_hit::HandleAfterEffectApply(), spell_dk_scourge_strike::HandleAfterHit(), spell_dru_enrage::HandleApply(), BattlegroundDS::HandleAreaTrigger(), OutdoorPvPSI::HandleAreaTrigger(), AuraEffect::HandleAuraMounted(), Aura::HandleAuraSpecificMods(), WorldSession::HandleBattleFieldPortOpcode(), spell_thaddius_pos_neg_charge::HandleDamage(), spell_capacitus_polarity_charge::HandleDamage(), spell_mage_summon_water_elemental::HandleDummy(), spell_rog_preparation::HandleDummy(), spell_warr_charge::HandleDummy(), spell_q12851_going_bearback::HandleEffectApply(), spell_dk_improved_blood_presence::HandleEffectApply(), spell_dk_improved_frost_presence::HandleEffectApply(), spell_dk_improved_unholy_presence::HandleEffectApply(), spell_oculus_soar_aura::HandleEffectPeriodic(), spell_rog_prey_on_the_weak::HandleEffectPeriodic(), spell_dk_improved_blood_presence::HandleEffectRemove(), spell_dk_improved_frost_presence::HandleEffectRemove(), spell_dk_improved_unholy_presence::HandleEffectRemove(), Player::HandleFall(), gm_commandscript::HandleGMVisibleCommand(), spell_dk_presence::HandleImprovedBloodPresence(), spell_dk_presence::HandleImprovedFrostPresence(), spell_dk_presence::HandleImprovedUnholyPresence(), spell_sindragosa_frost_breath::HandleInfusion(), BattlefieldWG::HandleKill(), lookup_commandscript::HandleLookupSpellCommand(), lookup_commandscript::HandleLookupSpellIdCommand(), WorldSession::HandleMessagechatOpcode(), spell_oculus_soar_aura::HandleOnEffectApply(), spell_mark_of_frost_freeze::HandleOnHit(), OPvPCapturePointZM_Graveyard::HandleOpenGo(), spell_hadronox_summon_periodic_aura::HandlePeriodic(), spell_serpentshrine_cavern_coilfang_water::HandlePeriodic(), spell_garr_separation_anxiety_aura::HandlePeriodic(), spell_majordomo_separation_anxiety_aura::HandlePeriodic(), spell_dk_blood_caked_blade::HandleProc(), spell_dru_glyph_of_shred::HandleProc(), spell_pal_infusion_of_light::HandleProc(), spell_pal_light_s_beacon::HandleProc(), spell_mage_gen_extra_effects::HandleProc(), spell_warr_vigilance::HandleRemove(), spell_najentus_hurl_spine::HandleSchoolDamage(), spell_pal_lay_on_hands::HandleScript(), spell_hun_pet_heart_of_the_phoenix::HandleScript(), spell_q12641_death_comes_from_on_high_recall_eye::HandleScriptEffect(), spell_q12611_deathbolt::HandleScriptEffect(), spell_dru_glyph_of_starfire::HandleScriptEffect(), misc_commandscript::HandleUnFreezeCommand(), HasAuras(), boss_yoggsaron_sara::InformCloud(), boss_taldaram::InitializeAI(), Player::IsDeserter(), SpellArea::IsFitToRequirements(), boss_krik_thir::boss_krik_thirAI::IsInFrenzy(), npc_anzu_spirit::IsSummonedBy(), go_wg_vehicle_teleporter::go_wg_vehicle_teleporterAI::IsValidVehicle(), lfg::LFGMgr::JoinLfg(), boss_blood_queen_lana_thel::boss_blood_queen_lana_thelAI::JustDied(), boss_professor_putricide::boss_professor_putricideAI::JustDied(), boss_sindragosa::boss_sindragosaAI::JustDied(), boss_hydross_the_unstable::JustDied(), boss_alar::JustDied(), npc_sunblade_scout::JustEngagedWith(), boss_zuljin::JustEngagedWith(), npc_high_overlord_saurfang_igb::npc_high_overlord_saurfang_igbAI::JustEngagedWith(), npc_muradin_bronzebeard_igb::npc_muradin_bronzebeard_igbAI::JustEngagedWith(), boss_bjarngrim::JustEngagedWith(), boss_freya_elder_stonebark::JustEngagedWith(), boss_freya_elder_brightleaf::JustEngagedWith(), boss_freya_elder_ironbranch::JustEngagedWith(), boss_nalorakk::JustEngagedWith(), npc_hivezara_stinger::JustEngagedWith(), boss_vem::JustEngagedWith(), npc_vekniss_stinger::JustEngagedWith(), boss_novos::JustEngagedWith(), boss_faerlina::boss_faerlinaAI::JustEngagedWith(), boss_gurtogg_bloodboil::JustEngagedWith(), boss_hydross_the_unstable::JustEngagedWith(), npc_akama_illidan::JustReachedHome(), boss_hydross_the_unstable::JustReachedHome(), Kill(), boss_hydross_the_unstable::KilledUnit(), boss_hadronox::KilledUnit(), Creature::LoadCreaturesAddon(), ModSpellCastTime(), npc_love_in_air_supply_sentry::MoveInLineOfSight(), npc_aged_dying_ancient_kodo::MoveInLineOfSight(), npc_custodian_of_time::npc_custodian_of_timeAI::MoveInLineOfSight(), boss_doomwalker::MoveInLineOfSight(), npc_daranelle::npc_daranelleAI::MoveInLineOfSight(), boss_lady_vashj::MovementInform(), boss_felmyst::MovementInform(), boss_kagani_nightstrike::MovementInform(), achievement_fa_la_la_la_ogrila::OnCheck(), instance_icecrown_citadel::instance_icecrown_citadel_InstanceMapScript::OnCreatureCreate(), npc_aged_dying_ancient_kodo::OnGossipHello(), npc_pet_gen_argent_pony_bridle::OnGossipHello(), npc_parqual_fintallas::OnGossipHello(), npc_wg_demolisher_engineer::OnGossipHello(), npc_innkeeper::OnGossipHello(), go_orb_of_domination::OnGossipHello(), npc_pet_gen_argent_pony_bridle::OnGossipSelect(), npc_innkeeper::OnGossipSelect(), spell_love_is_in_the_air_romantic_picnic::OnPeriodic(), instance_icecrown_citadel::instance_icecrown_citadel_InstanceMapScript::OnPlayerEnter(), MidsummerPlayerScript::OnPlayerUpdateZone(), spell_azjol_nerub_web_wrap_aura::OnRemove(), spell_icc_web_wrap_aura::OnRemove(), spell_gen_damage_reduction_aura::OnRemove(), spell_mage_missile_barrage_proc::OnRemove(), spell_mage_arcane_missiles::OnRemove(), at_karazhan_atiesh_aran::OnTrigger(), at_hor_battered_hilt_start::OnTrigger(), at_hor_battered_hilt_throw::OnTrigger(), AreaTrigger_at_nats_landing::OnTrigger(), at_bring_your_orphan_to::OnTrigger(), at_commander_dawnforge::OnTrigger(), Acore::FriendlyMissingBuffInRange::operator()(), NotInStomachSelector::operator()(), SindragosaIceTombCheck::operator()(), DefaultTargetSelector::operator()(), VampiricBiteTargetSelector::operator()(), LastPhaseIceTombTargetSelector::operator()(), NonTankLKTargetSelector::operator()(), WebTargetSelector::operator()(), ShadowOfDeathSelector::operator()(), Acore::UnitAuraCheck::operator()(), SpectralBlastCheck::operator()(), SmartScript::ProcessAction(), npc_lake_frog::npc_lake_frogAI::ReceiveEmote(), npc_dancing_flames::npc_dancing_flamesAI::ReceiveEmote(), Player::ReportedAfkBy(), npc_corrupted_totem::Reset(), boss_janalai::Reset(), npc_belnistrasz::npc_belnistraszAI::Reset(), boss_magus_telestra::Reset(), boss_illidan_stormrage::Reset(), boss_fathomlord_karathress::Reset(), Player::RewardHonor(), RewardRage(), npc_finklestein::npc_finklesteinAI::RightClickCauldron(), boss_jormungarAI::ScheduleEvents(), boss_supremus::SchedulePhase(), npc_icc_ice_sphere::npc_icc_ice_sphereAI::SelectNewTarget(), Player::SendInitialPacketsAfterAddToMap(), Player::SendQuestUpdate(), npc_corrupted_totem::SetAura(), npc_ulduar_harpoonfirestate::SetData(), boss_anomalus::SetData(), npc_chesspiece::sGossipHello(), npc_omen::npc_omenAI::SpellHit(), npc_nelson::npc_nelsonAI::SpellHit(), npc_necropolis::SpellHit(), npc_pool_of_tar::SpellHit(), boss_sister_svalna::boss_sister_svalnaAI::SpellHit(), boss_razorscale::SpellHit(), npc_tournament_training_dummy::npc_tournament_training_dummyAI::SpellHit(), npc_necrotic_shard::SpellHit(), boss_magus_telestra::SpellHit(), npc_mature_netherwing_drake::npc_mature_netherwing_drakeAI::SpellHit(), SpellPctDamageModsDone(), SpellTakenCritChance(), boss_moam::SummonedCreatureDies(), boss_apothecary_hummel::boss_apothecary_hummelAI::SummonedCreatureDies(), npc_blackhand_incarcerator::npc_blackhand_incarceratorAI::UpdateAI(), boss_vaelastrasz::boss_vaelAI::UpdateAI(), npc_mc_core_hound::npc_mc_core_houndAI::UpdateAI(), npc_cyclone::UpdateAI(), boss_kirtonos_the_herald::boss_kirtonos_the_heraldAI::UpdateAI(), npc_lady_sylvanas_windrunner::npc_lady_sylvanas_windrunnerAI::UpdateAI(), boss_hakkar::boss_hakkarAI::UpdateAI(), npc_onyxian_lair_guard::UpdateAI(), boss_moam::UpdateAI(), boss_ossirian::UpdateAI(), boss_elder_nadox::UpdateAI(), boss_grand_champion::boss_grand_championAI::UpdateAI(), boss_anubarak_trial::boss_anubarak_trialAI::UpdateAI(), npc_nerubian_burrower::npc_nerubian_burrowerAI::UpdateAI(), npc_anubarak_spike::npc_anubarak_spikeAI::UpdateAI(), npc_hor_lich_king::npc_hor_lich_kingAI::UpdateAI(), boss_blood_queen_lana_thel::boss_blood_queen_lana_thelAI::UpdateAI(), npc_gunship_boarding_leader::npc_gunship_boarding_leaderAI::UpdateAI(), boss_lady_deathwhisper::boss_lady_deathwhisperAI::UpdateAI(), boss_lord_marrowgar::UpdateAI(), npc_putricide_oozeAI::UpdateAI(), npc_ice_tomb::npc_ice_tombAI::UpdateAI(), npc_icc_vengeful_fleshreaper::npc_icc_vengeful_fleshreaperAI::UpdateAI(), boss_kelthuzad::boss_kelthuzadAI::UpdateAI(), boss_anomalus::UpdateAI(), boss_magus_telestra::UpdateAI(), boss_freya_elder_stonebark::UpdateAI(), boss_vezax::UpdateAI(), npc_ulduar_hodir_priest::UpdateAI(), npc_ulduar_hodir_druid::UpdateAI(), npc_ulduar_hodir_shaman::UpdateAI(), npc_ulduar_hodir_mage::UpdateAI(), boss_thorim_start_npcs::UpdateAI(), boss_thorim_gauntlet_npcs::UpdateAI(), npc_ulduar_storm_tempered_keeper::UpdateAI(), npc_imprisoned_beryl_sorcerer::npc_imprisoned_beryl_sorcererAI::UpdateAI(), npc_lake_frog::npc_lake_frogAI::UpdateAI(), npc_tournament_training_dummy::npc_tournament_training_dummyAI::UpdateAI(), npc_artorius::npc_artoriusAI::UpdateAI(), boss_ichoron::boss_ichoronAI::UpdateAI(), npc_dark_fiend::UpdateAI(), Player::UpdateAreaDependentAuras(), boss_yoggsaron_cloud::UpdateEscortAI(), boss_netherspite::UpdatePortals(), Player::UpdateZoneDependentAuras(), and Spell::WriteAmmoToPacket().

◆ HasAuraEffect()

bool Unit::HasAuraEffect ( uint32  spellId,
uint8  effIndex,
ObjectGuid  caster = ObjectGuid::Empty 
) const
5894{
5895 AuraApplicationMapBounds range = m_appliedAuras.equal_range(spellId);
5896 for (AuraApplicationMap::const_iterator itr = range.first; itr != range.second; ++itr)
5897 {
5898 if (itr->second->HasEffect(effIndex)
5899 && (!caster || itr->second->GetBase()->GetCasterGUID() == caster))
5900 {
5901 return true;
5902 }
5903 }
5904 return false;
5905}

References m_appliedAuras.

Referenced by AuraEffect::HandleAuraModIncreaseFlightSpeed(), spell_q12683_take_sputum_sample::HandleDummy(), AchievementCriteriaData::Meets(), and boss_headless_horseman::UpdateAI().

◆ HasAuras()

bool Unit::HasAuras ( SearchMethod  sm,
std::vector< uint32 > &  spellIds 
) const

Check if unit has ANY or ALL specified auras.

Parameters
smThe search method to use
spellIdsList of spell id's to check for on the unit.
Returns
Returns true if the search method condition is met. Otherwise false.
5924{
5925 if (sm == SearchMethod::MatchAll)
5926 {
5927 for (auto const& spellId : spellIds)
5928 if (!HasAura(spellId))
5929 return false;
5930 return true;
5931 }
5932 else if (sm == SearchMethod::MatchAny)
5933 {
5934 for (auto const& spellId : spellIds)
5935 if (HasAura(spellId))
5936 return true;
5937 return false;
5938 }
5939 else
5940 {
5941 LOG_ERROR("entities.unit", "Unit::HasAuras using non-supported SearchMethod {}", sm);
5942 return false;
5943 }
5944}

References HasAura(), LOG_ERROR, MatchAll, and MatchAny.

Referenced by HasAllAuras(), and HasAnyAuras().

◆ HasAuraState()

bool Unit::HasAuraState ( AuraStateType  flag,
SpellInfo const *  spellProto = nullptr,
Unit const *  Caster = nullptr 
) const
7537{
7538 if (Caster)
7539 {
7540 if (spellProto)
7541 {
7542 AuraEffectList const& stateAuras = Caster->GetAuraEffectsByType(SPELL_AURA_ABILITY_IGNORE_AURASTATE);
7543 for (AuraEffectList::const_iterator j = stateAuras.begin(); j != stateAuras.end(); ++j)
7544 if ((*j)->IsAffectedOnSpell(spellProto))
7545 return true;
7546 }
7547 // Check per caster aura state
7548 // If aura with aurastate by caster not found return false
7549 if ((1 << (flag - 1)) & PER_CASTER_AURA_STATE_MASK)
7550 {
7551 AuraStateAurasMapBounds range = m_auraStateAuras.equal_range(flag);
7552 for (AuraStateAurasMap::const_iterator itr = range.first; itr != range.second; ++itr)
7553 if (itr->second->GetBase()->GetCasterGUID() == Caster->GetGUID())
7554 return true;
7555 return false;
7556 }
7557 }
7558
7559 return HasFlag(UNIT_FIELD_AURASTATE, 1 << (flag - 1));
7560}
@ SPELL_AURA_ABILITY_IGNORE_AURASTATE
Definition SpellAuraDefines.h:325
std::pair< AuraStateAurasMap::const_iterator, AuraStateAurasMap::const_iterator > AuraStateAurasMapBounds
Definition Unit.h:672

References GetAuraEffectsByType(), Object::GetGUID(), Object::HasFlag(), m_auraStateAuras, PER_CASTER_AURA_STATE_MASK, SPELL_AURA_ABILITY_IGNORE_AURASTATE, and UNIT_FIELD_AURASTATE.

Referenced by Player::_addSpell(), Pet::addSpell(), Spell::CheckCast(), spell_sha_earthliving_weapon::CheckProc(), spell_warl_decimation::CheckProc(), SpellInfo::CheckTarget(), ClearAllReactives(), Spell::EffectHeal(), Spell::EffectSchoolDMG(), Spell::EffectWeaponDmg(), spell_warr_sweeping_strikes::HandleProc(), isFrozen(), Player::LoadFromDB(), SpellPctDamageModsDone(), SpellTakenCritChance(), and UpdateReactives().

◆ HasAuraType()

bool Unit::HasAuraType ( AuraType  auraType) const
5954{
5955 return (!m_modAuras[auraType].empty());
5956}

References m_modAuras.

Referenced by Player::CanTameExoticPets(), AuraEffect::HandleArenaPreparation(), AuraEffect::HandleAuraAllowFlight(), AuraEffect::HandleAuraEmpathy(), AuraEffect::HandleAuraFeatherFall(), AuraEffect::HandleAuraHover(), AuraEffect::HandleAuraModDisarm(), AuraEffect::HandleAuraModStalked(), AuraEffect::HandleAuraTrackStealthed(), AuraEffect::HandleAuraUntrackable(), AuraEffect::HandleAuraWaterWalk(), AuraEffect::HandleComprehendLanguage(), AuraEffect::HandleForceMoveForward(), HasAllowOnlyAbilityAura(), HasAOECharmAura(), HasAttackerSpellCritChanceAura(), HasAuraTypeWithFamilyFlags(), HasCloneCasterAura(), HasConfuseAura(), HasControlVehicleAura(), HasDecreaseSpeedAura(), HasDetectAmoreAura(), HasDetectSpellsAura(), HasFearAura(), HasFeatherFallAura(), HasFlyAura(), HasGhostAura(), HasHealthRegenInCombatAura(), HasHoverAura(), HasIgnoreHitDirectionAura(), HasIgnoreTargetResistAura(), HasIncreaseMountedFlightSpeedAura(), HasIncreaseMountedSpeedAura(), HasInterruptRegenAura(), HasInvisibilityAura(), HasInvisibilityDetectAura(), HasMountedAura(), HasNoPVPCreditAura(), HasOpenStableAura(), HasPacifyAura(), HasPacifySilenceAura(), HasPeriodicDummyAura(), HasPreventDurabilityLossAura(), HasPreventResurectionAura(), HasPreventsFleeingAura(), HasReflectSpellsAura(), HasRegenDuringCombatAura(), HasRootAura(), HasShapeshiftAura(), HasSilenceAura(), HasSpellMagnetAura(), HasSpiritOfRedemptionAura(), HasStealthAura(), HasStealthDetectAura(), HasStunAura(), HasTauntAura(), HasThreatAura(), HasTransformAura(), HasUnattackableAura(), HasWaterBreathingAura(), HasWaterWalkAura(), Player::IsFreeFlying(), and Player::SendInitialPacketsAfterAddToMap().

◆ HasAuraTypeWithAffectMask()

bool Unit::HasAuraTypeWithAffectMask ( AuraType  auratype,
SpellInfo const *  affectedSpell 
) const
5987{
5988 AuraEffectList const& mTotalAuraList = GetAuraEffectsByType(auratype);
5989 for (AuraEffectList::const_iterator i = mTotalAuraList.begin(); i != mTotalAuraList.end(); ++i)
5990 if ((*i)->IsAffectedOnSpell(affectedSpell))
5991 return true;
5992 return false;
5993}

References GetAuraEffectsByType().

Referenced by AuraEffect::CalculatePeriodic(), Spell::DoSpellHitOnUnit(), Spell::handle_immediate(), Aura::RefreshDuration(), and Aura::RefreshTimersWithMods().

◆ HasAuraTypeWithCaster()

bool Unit::HasAuraTypeWithCaster ( AuraType  auratype,
ObjectGuid  caster 
) const
5959{
5960 AuraEffectList const& mTotalAuraList = GetAuraEffectsByType(auratype);
5961 for (AuraEffectList::const_iterator i = mTotalAuraList.begin(); i != mTotalAuraList.end(); ++i)
5962 if (caster == (*i)->GetCasterGUID())
5963 return true;
5964 return false;
5965}

References GetAuraEffectsByType().

Referenced by BuildValuesUpdate(), IsAlwaysDetectableFor(), ThreatContainer::IsPreferredTarget(), and PatchValuesUpdate().

◆ HasAuraTypeWithFamilyFlags()

bool Unit::HasAuraTypeWithFamilyFlags ( AuraType  auraType,
uint32  familyName,
uint32  familyFlags 
) const
888{
889 if (!HasAuraType(auraType))
890 return false;
891 AuraEffectList const& auras = GetAuraEffectsByType(auraType);
892 for (AuraEffectList::const_iterator itr = auras.begin(); itr != auras.end(); ++itr)
893 if (SpellInfo const* iterSpellProto = (*itr)->GetSpellInfo())
894 if (iterSpellProto->SpellFamilyName == familyName && iterSpellProto->SpellFamilyFlags[0] & familyFlags)
895 return true;
896 return false;
897}

References GetAuraEffectsByType(), and HasAuraType().

◆ HasAuraTypeWithMiscvalue()

bool Unit::HasAuraTypeWithMiscvalue ( AuraType  auratype,
int32  miscvalue 
) const
5978{
5979 AuraEffectList const& mTotalAuraList = GetAuraEffectsByType(auratype);
5980 for (AuraEffectList::const_iterator i = mTotalAuraList.begin(); i != mTotalAuraList.end(); ++i)
5981 if (miscvalue == (*i)->GetMiscValue())
5982 return true;
5983 return false;
5984}

References GetAuraEffectsByType().

Referenced by Player::Regenerate(), Player::UpdateManaRegen(), and Player::UpdateStats().

◆ HasAuraTypeWithTriggerSpell()

bool Unit::HasAuraTypeWithTriggerSpell ( AuraType  auratype,
uint32  triggerSpell 
) const
6005{
6006 for (AuraEffect const* aura : GetAuraEffectsByType(auratype))
6007 {
6008 if (aura->GetSpellInfo()->Effects[aura->GetEffIndex()].TriggerSpell == triggerSpell)
6009 {
6010 return true;
6011 }
6012 }
6013
6014 return false;
6015}

References GetAuraEffectsByType().

Referenced by WorldSession::HandlePetActionHelper().

◆ HasAuraTypeWithValue()

bool Unit::HasAuraTypeWithValue ( AuraType  auratype,
int32  value 
) const
5996{
5997 AuraEffectList const& mTotalAuraList = GetAuraEffectsByType(auratype);
5998 for (AuraEffectList::const_iterator i = mTotalAuraList.begin(); i != mTotalAuraList.end(); ++i)
5999 if (value == (*i)->GetAmount())
6000 return true;
6001 return false;
6002}

References GetAuraEffectsByType().

◆ HasAuraWithMechanic()

bool Unit::HasAuraWithMechanic ( uint32  mechanicMask) const
6041{
6042 for (AuraApplicationMap::const_iterator iter = m_appliedAuras.begin(); iter != m_appliedAuras.end(); ++iter)
6043 {
6044 SpellInfo const* spellInfo = iter->second->GetBase()->GetSpellInfo();
6045 if (spellInfo->Mechanic && (mechanicMask & (1 << spellInfo->Mechanic)))
6046 return true;
6047
6048 for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
6049 if (iter->second->HasEffect(i) && spellInfo->Effects[i].Effect && spellInfo->Effects[i].Mechanic)
6050 if (mechanicMask & (1 << spellInfo->Effects[i].Mechanic))
6051 return true;
6052 }
6053
6054 return false;
6055}

References SpellInfo::Effects, m_appliedAuras, MAX_SPELL_EFFECTS, and SpellInfo::Mechanic.

Referenced by EarthenPowerTargetSelector::operator()(), SpellPctDamageModsDone(), and SpellTakenCritChance().

◆ HasBreakableByDamageAuraType()

bool Unit::HasBreakableByDamageAuraType ( AuraType  type,
uint32  excludeAura = 0 
) const
900{
901 AuraEffectList const& auras = GetAuraEffectsByType(type);
902 for (AuraEffectList::const_iterator itr = auras.begin(); itr != auras.end(); ++itr)
903 if ((!excludeAura || excludeAura != (*itr)->GetSpellInfo()->Id) && //Avoid self interrupt of channeled Crowd Control spells like Seduction
904 ((*itr)->GetSpellInfo()->AuraInterruptFlags & AURA_INTERRUPT_FLAG_TAKE_DAMAGE))
905 return true;
906 return false;
907}

References AURA_INTERRUPT_FLAG_TAKE_DAMAGE, and GetAuraEffectsByType().

Referenced by HasBreakableByDamageCrowdControlAura().

◆ HasBreakableByDamageCrowdControlAura()

bool Unit::HasBreakableByDamageCrowdControlAura ( Unit excludeCasterChannel = nullptr) const
910{
911 uint32 excludeAura = 0;
912 if (Spell* currentChanneledSpell = excludeCasterChannel ? excludeCasterChannel->GetCurrentSpell(CURRENT_CHANNELED_SPELL) : nullptr)
913 excludeAura = currentChanneledSpell->GetSpellInfo()->Id; //Avoid self interrupt of channeled Crowd Control spells like Seduction
914
920}
@ SPELL_AURA_MOD_FEAR
Definition SpellAuraDefines.h:70
@ SPELL_AURA_MOD_ROOT
Definition SpellAuraDefines.h:89
@ SPELL_AURA_TRANSFORM
Definition SpellAuraDefines.h:119
@ SPELL_AURA_MOD_CONFUSE
Definition SpellAuraDefines.h:68
@ SPELL_AURA_MOD_STUN
Definition SpellAuraDefines.h:75
bool HasBreakableByDamageAuraType(AuraType type, uint32 excludeAura=0) const
Definition Unit.cpp:899
Spell * GetCurrentSpell(CurrentSpellTypes spellType) const
Definition Unit.h:1565

References CURRENT_CHANNELED_SPELL, GetCurrentSpell(), HasBreakableByDamageAuraType(), SPELL_AURA_MOD_CONFUSE, SPELL_AURA_MOD_FEAR, SPELL_AURA_MOD_ROOT, SPELL_AURA_MOD_STUN, and SPELL_AURA_TRANSFORM.

Referenced by PetAI::CanAttack(), npc_pet_gen_valkyr_guardian::OwnerAttacked(), CasterAI::UpdateAI(), npc_pet_gen_valkyr_guardian::UpdateAI(), npc_pet_hunter_snake_trap::UpdateAI(), npc_pet_mage_mirror_image::UpdateAI(), and PetAI::UpdateAI().

◆ HasCloneCasterAura()

bool Unit::HasCloneCasterAura ( ) const
inline
@ SPELL_AURA_CLONE_CASTER
Definition SpellAuraDefines.h:310

References HasAuraType(), and SPELL_AURA_CLONE_CASTER.

Referenced by WorldSession::HandleMirrorImageDataRequest().

◆ HasConfuseAura()

bool Unit::HasConfuseAura ( ) const
inline

◆ HasControlVehicleAura()

bool Unit::HasControlVehicleAura ( ) const
inline

◆ HasDecreaseSpeedAura()

bool Unit::HasDecreaseSpeedAura ( ) const
inline
@ SPELL_AURA_MOD_DECREASE_SPEED
Definition SpellAuraDefines.h:96

References HasAuraType(), and SPELL_AURA_MOD_DECREASE_SPEED.

Referenced by Spell::EffectWeaponDmg().

◆ HasDetectAmoreAura()

bool Unit::HasDetectAmoreAura ( ) const
inline
@ SPELL_AURA_DETECT_AMORE
Definition SpellAuraDefines.h:233

References HasAuraType(), and SPELL_AURA_DETECT_AMORE.

Referenced by AuraEffect::HandleDetectAmore().

◆ HasDetectSpellsAura()

bool Unit::HasDetectSpellsAura ( ) const
inline
@ SPELL_AURA_DEFLECT_SPELLS
Definition SpellAuraDefines.h:350

References HasAuraType(), and SPELL_AURA_DEFLECT_SPELLS.

◆ HasExtraUnitMovementFlag()

uint16 Unit::HasExtraUnitMovementFlag ( uint16  f) const
inline

◆ HasFearAura()

◆ HasFeatherFallAura()

bool Unit::HasFeatherFallAura ( ) const
inline
@ SPELL_AURA_FEATHER_FALL
Definition SpellAuraDefines.h:168

References HasAuraType(), and SPELL_AURA_FEATHER_FALL.

Referenced by Player::HandleFall().

◆ HasFlyAura()

◆ HasGhostAura()

bool Unit::HasGhostAura ( ) const
inline

◆ HasHealthRegenInCombatAura()

bool Unit::HasHealthRegenInCombatAura ( ) const
inline
@ SPELL_AURA_MOD_HEALTH_REGEN_IN_COMBAT
Definition SpellAuraDefines.h:224

References HasAuraType(), and SPELL_AURA_MOD_HEALTH_REGEN_IN_COMBAT.

Referenced by Player::RegenerateAll().

◆ HasHoverAura()

bool Unit::HasHoverAura ( ) const
inline
1786{ return HasAuraType(SPELL_AURA_HOVER); };
@ SPELL_AURA_HOVER
Definition SpellAuraDefines.h:169

References HasAuraType(), and SPELL_AURA_HOVER.

Referenced by Player::HandleFall(), and Creature::UpdateMovementFlags().

◆ HasIgnoreHitDirectionAura()

bool Unit::HasIgnoreHitDirectionAura ( ) const
inline

◆ HasIgnoreTargetResistAura()

bool Unit::HasIgnoreTargetResistAura ( ) const
inline

◆ HasIncreaseMountedFlightSpeedAura()

◆ HasIncreaseMountedSpeedAura()

bool Unit::HasIncreaseMountedSpeedAura ( ) const
inline
@ SPELL_AURA_MOD_INCREASE_MOUNTED_SPEED
Definition SpellAuraDefines.h:95

References HasAuraType(), and SPELL_AURA_MOD_INCREASE_MOUNTED_SPEED.

◆ HasInterruptRegenAura()

bool Unit::HasInterruptRegenAura ( ) const
inline
@ SPELL_AURA_INTERRUPT_REGEN
Definition SpellAuraDefines.h:157

References HasAuraType(), and SPELL_AURA_INTERRUPT_REGEN.

Referenced by Player::Regenerate().

◆ HasInvisibilityAura()

bool Unit::HasInvisibilityAura ( ) const
inline

◆ HasInvisibilityDetectAura()

bool Unit::HasInvisibilityDetectAura ( ) const
inline
@ SPELL_AURA_MOD_INVISIBILITY_DETECT
Definition SpellAuraDefines.h:82

References HasAuraType(), and SPELL_AURA_MOD_INVISIBILITY_DETECT.

Referenced by AuraEffect::HandleModInvisibilityDetect().

◆ HasLeewayMovement()

bool Unit::HasLeewayMovement ( ) const
inline
1714 {
1716 && !IsWalking();
1717 }
@ MOVEMENTFLAG_STRAFE_LEFT
Definition UnitDefines.h:371
@ MOVEMENTFLAG_STRAFE_RIGHT
Definition UnitDefines.h:372
bool IsWalking() const
Definition Unit.h:1691
bool HasMovementFlag(uint32 flag) const
Definition Object.h:345

References MovementInfo::HasMovementFlag(), IsWalking(), WorldObject::m_movementInfo, MOVEMENTFLAG_FALLING, MOVEMENTFLAG_FORWARD, MOVEMENTFLAG_STRAFE_LEFT, and MOVEMENTFLAG_STRAFE_RIGHT.

Referenced by Spell::CheckRange(), and IsWithinMeleeRange().

◆ HasMainhandWeapon()

bool Unit::HasMainhandWeapon ( ) const
inline
972{ return HasWeapon(BASE_ATTACK); }
virtual bool HasWeapon(WeaponAttackType type) const =0

References BASE_ATTACK, and HasWeapon().

◆ hasMainhandWeaponForAttack()

bool Unit::hasMainhandWeaponForAttack ( ) const
inline
virtual bool HasWeaponForAttack(WeaponAttackType type) const
Definition Unit.h:977

References BASE_ATTACK, and HasWeaponForAttack().

◆ HasMainhandWeaponForAttack()

bool Unit::HasMainhandWeaponForAttack ( ) const
inline

◆ HasMountedAura()

◆ HasNegativeAuraWithAttribute()

bool Unit::HasNegativeAuraWithAttribute ( uint32  flag,
ObjectGuid  guid = ObjectGuid::Empty 
)
6030{
6031 for (AuraApplicationMap::const_iterator iter = m_appliedAuras.begin(); iter != m_appliedAuras.end(); ++iter)
6032 {
6033 Aura const* aura = iter->second->GetBase();
6034 if (!iter->second->IsPositive() && aura->GetSpellInfo()->Attributes & flag && (!guid || aura->GetCasterGUID() == guid))
6035 return true;
6036 }
6037 return false;
6038}
uint32 Attributes
Definition SpellInfo.h:324

References SpellInfo::Attributes, Aura::GetCasterGUID(), Aura::GetSpellInfo(), and m_appliedAuras.

◆ HasNegativeAuraWithInterruptFlag()

bool Unit::HasNegativeAuraWithInterruptFlag ( uint32  flag,
ObjectGuid  guid = ObjectGuid::Empty 
)
6018{
6019 if (!(m_interruptMask & flag))
6020 return false;
6021 for (AuraApplicationList::iterator iter = m_interruptableAuras.begin(); iter != m_interruptableAuras.end(); ++iter)
6022 {
6023 if (!(*iter)->IsPositive() && (*iter)->GetBase()->GetSpellInfo()->AuraInterruptFlags & flag && (!guid || (*iter)->GetBase()->GetCasterGUID() == guid))
6024 return true;
6025 }
6026 return false;
6027}

References m_interruptableAuras, and m_interruptMask.

Referenced by ThreatContainer::IsPreferredTarget().

◆ HasNoPVPCreditAura()

bool Unit::HasNoPVPCreditAura ( ) const
inline
@ SPELL_AURA_NO_PVP_CREDIT
Definition SpellAuraDefines.h:222

References HasAuraType(), and SPELL_AURA_NO_PVP_CREDIT.

Referenced by Player::RewardHonor().

◆ HasNpcFlag()

bool Unit::HasNpcFlag ( NPCFlags  flags) const
inline

◆ HasOffhandWeapon()

bool Unit::HasOffhandWeapon ( ) const
inline
973{ return HasWeapon(OFF_ATTACK); }

References HasWeapon(), and OFF_ATTACK.

◆ HasOffhandWeaponForAttack()

◆ HasOpenStableAura()

bool Unit::HasOpenStableAura ( ) const
inline
@ SPELL_AURA_OPEN_STABLE
Definition SpellAuraDefines.h:355

References HasAuraType(), and SPELL_AURA_OPEN_STABLE.

◆ HasPacifyAura()

bool Unit::HasPacifyAura ( ) const
inline
@ SPELL_AURA_MOD_PACIFY
Definition SpellAuraDefines.h:88

References HasAuraType(), and SPELL_AURA_MOD_PACIFY.

Referenced by AuraEffect::HandleAuraModPacify(), and WorldSession::HandlePetActionHelper().

◆ HasPacifySilenceAura()

bool Unit::HasPacifySilenceAura ( ) const
inline

◆ HasPeriodicDummyAura()

bool Unit::HasPeriodicDummyAura ( ) const
inline
@ SPELL_AURA_PERIODIC_DUMMY
Definition SpellAuraDefines.h:289

References HasAuraType(), and SPELL_AURA_PERIODIC_DUMMY.

◆ HasPreventDurabilityLossAura()

bool Unit::HasPreventDurabilityLossAura ( ) const
inline
@ SPELL_AURA_PREVENT_DURABILITY_LOSS
Definition SpellAuraDefines.h:352

References HasAuraType(), and SPELL_AURA_PREVENT_DURABILITY_LOSS.

Referenced by Player::DurabilityPointsLoss().

◆ HasPreventResurectionAura()

bool Unit::HasPreventResurectionAura ( ) const
inline

◆ HasPreventsFleeingAura()

bool Unit::HasPreventsFleeingAura ( ) const
inline
@ SPELL_AURA_PREVENTS_FLEEING
Definition SpellAuraDefines.h:155

References HasAuraType(), and SPELL_AURA_PREVENTS_FLEEING.

Referenced by Creature::DoFleeToGetAssistance().

◆ HasRangedWeapon()

bool Unit::HasRangedWeapon ( ) const
inline
974{ return HasWeapon(RANGED_ATTACK); }

References HasWeapon(), and RANGED_ATTACK.

◆ HasRangedWeaponForAttack()

bool Unit::HasRangedWeaponForAttack ( ) const
inline

◆ HasReflectSpellsAura()

bool Unit::HasReflectSpellsAura ( ) const
inline
@ SPELL_AURA_REFLECT_SPELLS
Definition SpellAuraDefines.h:91

References HasAuraType(), and SPELL_AURA_REFLECT_SPELLS.

Referenced by Spell::DoSpellHitOnUnit().

◆ HasRegenDuringCombatAura()

bool Unit::HasRegenDuringCombatAura ( ) const
inline
@ SPELL_AURA_MOD_REGEN_DURING_COMBAT
Definition SpellAuraDefines.h:179

References HasAuraType(), and SPELL_AURA_MOD_REGEN_DURING_COMBAT.

Referenced by Player::RegenerateAll(), and Player::RegenerateHealth().

◆ HasRootAura()

bool Unit::HasRootAura ( ) const
inline

References HasAuraType(), and SPELL_AURA_MOD_ROOT.

Referenced by SetControlled().

◆ HasShapeshiftAura()

bool Unit::HasShapeshiftAura ( ) const
inline

◆ HasSharedVision()

◆ HasSilenceAura()

bool Unit::HasSilenceAura ( ) const
inline

◆ HasSpell()

◆ HasSpellCooldown()

◆ HasSpellItemCooldown()

virtual bool Unit::HasSpellItemCooldown ( uint32  ,
uint32   
) const
inlinevirtual

Reimplemented in Player.

1325{ return false; }

Referenced by Spell::CheckCast().

◆ HasSpellMagnetAura()

bool Unit::HasSpellMagnetAura ( ) const
inline

◆ HasSpiritOfRedemptionAura()

◆ HasStealthAura()

◆ HasStealthDetectAura()

bool Unit::HasStealthDetectAura ( ) const
inline
@ SPELL_AURA_MOD_STEALTH_DETECT
Definition SpellAuraDefines.h:80

References HasAuraType(), and SPELL_AURA_MOD_STEALTH_DETECT.

Referenced by AuraEffect::HandleModStealthDetect().

◆ HasStunAura()

bool Unit::HasStunAura ( ) const
inline

◆ HasTauntAura()

bool Unit::HasTauntAura ( ) const
inline
@ SPELL_AURA_MOD_TAUNT
Definition SpellAuraDefines.h:74

References HasAuraType(), and SPELL_AURA_MOD_TAUNT.

Referenced by Creature::CanCreatureAttack(), and PetAI::SelectNextTarget().

◆ HasThreatAura()

bool Unit::HasThreatAura ( ) const
inline
@ SPELL_AURA_MOD_THREAT
Definition SpellAuraDefines.h:73

References HasAuraType(), and SPELL_AURA_MOD_THREAT.

Referenced by ApplyTotalThreatModifier().

◆ HasTransformAura()

bool Unit::HasTransformAura ( ) const
inline

◆ HasUnattackableAura()

bool Unit::HasUnattackableAura ( ) const
inline

◆ HasUnitFlag()

bool Unit::HasUnitFlag ( UnitFlags  flags) const
inline
741{ return HasFlag(UNIT_FIELD_FLAGS, flags); }

References Object::HasFlag(), and UNIT_FIELD_FLAGS.

Referenced by _IsValidAssistTarget(), _IsValidAttackTarget(), Player::ActivateTaxiPathTo(), Vehicle::AddPassenger(), AttackerStateUpdate(), boss_malygos::AttackStart(), SmartAI::AttackStart(), npc_ghostly_priest::npc_ghostly_priestAI::AttackStart(), npc_phantom_mage::npc_phantom_mageAI::AttackStart(), npc_shadowy_mercenary::npc_shadowy_mercenaryAI::AttackStart(), npc_spectral_footman::npc_spectral_footmanAI::AttackStart(), npc_tortured_rifleman::npc_tortured_riflemanAI::AttackStart(), violet_hold_trashAI::AttackStart(), npc_q24545_wretched_ghoul::npc_q24545_wretched_ghoulAI::AttackStart(), npc_ravenous_worg::npc_ravenous_worgAI::AttackStart(), npc_swarm_scarab::npc_swarm_scarabAI::CanAIAttack(), npc_q24545_wretched_ghoul::npc_q24545_wretched_ghoulAI::CanAIAttack(), Creature::CanAssistTo(), PetAI::CanAttack(), Player::CanNoReagentCast(), CanSwim(), CanUseAttackType(), Spell::CheckEffectTarget(), boss_muru::DamageTaken(), boss_black_knight::boss_black_knightAI::DamageTaken(), npc_frost_sphere::npc_frost_sphereAI::DamageTaken(), boss_bronjahm::boss_bronjahmAI::DamageTaken(), npc_terenas_menethil::npc_terenas_menethilAI::DamageTaken(), npc_power_spark::DamageTaken(), boss_hodir::DamageTaken(), npc_ulduar_leviathan_mkii::DamageTaken(), npc_ulduar_vx001::DamageTaken(), npc_ulduar_aerial_command_unit::DamageTaken(), npc_overlord_drakuru_betrayal::DamageTaken(), boss_essence_of_suffering::boss_essence_of_sufferingAI::DamageTaken(), boss_essence_of_desire::boss_essence_of_desireAI::DamageTaken(), npc_terenas_menethil::npc_terenas_menethilAI::DoAction(), instance_karazhan::instance_karazhan_InstanceMapScript::DoAction(), boss_jormungarAI::DoAction(), Spell::DoSpellHitOnUnit(), RandomMovementGenerator< T >::DoUpdate(), boss_dorothee::EnterEvadeMode(), boss_roar::EnterEvadeMode(), boss_strawman::EnterEvadeMode(), boss_tinhead::EnterEvadeMode(), boss_julianne::EnterEvadeMode(), SmartAI::EnterEvadeMode(), GetReactionTo(), GetVelocity(), spell_gen_model_visible::HandleEffectApply(), boss_sartharion_dragonAI::HandleExtraEvent(), spell_gen_mounted_charge::HandleScriptEffect(), IsImmuneToNPC(), IsImmuneToPC(), IsInCombat(), IsMounted(), IsPetInCombat(), isTargetableForAttack(), violet_hold_trashAI::JustEngagedWith(), boss_novos::JustSummoned(), CreatureGroup::LeaderMoveTo(), Condition::Meets(), MotionMaster::MoveCharge(), MotionMaster::MoveChase(), MotionMaster::MoveConfused(), MotionMaster::MoveDistract(), MotionMaster::MoveFall(), MotionMaster::MoveFleeing(), MotionMaster::MoveFollow(), boss_sartharion_dragonAI::MoveInLineOfSight(), boss_professor_putricide::boss_professor_putricideAI::MoveInLineOfSight(), boss_palehoof::boss_palehoofAI::MoveInLineOfSight(), npc_massive_jormungar::npc_massive_jormungarAI::MoveInLineOfSight(), npc_ferocious_rhino::npc_ferocious_rhinoAI::MoveInLineOfSight(), npc_ravenous_furbolg::npc_ravenous_furbolgAI::MoveInLineOfSight(), npc_frenzied_worgen::npc_frenzied_worgenAI::MoveInLineOfSight(), npc_shattered_hand_scout::MoveInLineOfSight(), npc_nether_drake::npc_nether_drakeAI::MoveInLineOfSight(), MotionMaster::MoveLand(), npc_koltira_deathweaver::npc_koltira_deathweaverAI::MovementInform(), MotionMaster::MovePoint(), MotionMaster::MoveRandom(), MotionMaster::MoveSeekAssistance(), MotionMaster::MoveSeekAssistanceDistract(), MotionMaster::MoveSplinePath(), MotionMaster::MoveTakeoff(), MotionMaster::MoveTargetedHome(), MotionMaster::MoveWaypoint(), npc_toc_druid::npc_toc_druidAI::myCanCast(), npc_toc_shaman::npc_toc_shamanAI::myCanCast(), npc_toc_paladin::npc_toc_paladinAI::myCanCast(), npc_toc_priest::npc_toc_priestAI::myCanCast(), npc_toc_shadow_priest::npc_toc_shadow_priestAI::myCanCast(), npc_toc_warlock::npc_toc_warlockAI::myCanCast(), npc_toc_mage::npc_toc_mageAI::myCanCast(), npc_toc_boomkin::npc_toc_boomkinAI::myCanCast(), npc_toc_pet_warlock::npc_toc_pet_warlockAI::myCanCast(), Acore::AnyAttackableUnitExceptForOriginalCasterInObjectRangeCheck::operator()(), WorldSession::ProcessMovementInfo(), Creature::reachWithSpellAttack(), Creature::reachWithSpellCure(), Creature::RefreshSwimmingFlag(), ScriptedAI::SelectSpell(), SetCharm(), Player::SetClientControl(), SetSpeed(), boss_the_lurker_below::SummonedCreatureDies(), boss_anub_arak::SummonedCreatureDies(), Player::Update(), npc_onyxian_lair_guard::UpdateAI(), boss_anub_arak::UpdateAI(), boss_anubarak_trial::boss_anubarak_trialAI::UpdateAI(), npc_toc_warrior::npc_toc_warriorAI::UpdateAI(), npc_toc_dk::npc_toc_dkAI::UpdateAI(), npc_toc_rogue::npc_toc_rogueAI::UpdateAI(), npc_toc_enh_shaman::npc_toc_enh_shamanAI::UpdateAI(), npc_toc_retro_paladin::npc_toc_retro_paladinAI::UpdateAI(), boss_gormok::boss_gormokAI::UpdateAI(), boss_jormungarAI::UpdateAI(), boss_novos::UpdateAI(), boss_bronjahm::boss_bronjahmAI::UpdateAI(), boss_drakkari_colossus::boss_drakkari_colossusAI::UpdateAI(), npc_frostwing_vrykul::npc_frostwing_vrykulAI::UpdateAI(), boss_kelthuzad::boss_kelthuzadAI::UpdateAI(), npc_power_spark::UpdateAI(), boss_thorim_arena_npcs::UpdateAI(), npc_xt002_heart::UpdateAI(), boss_ingvar_the_plunderer::UpdateAI(), npc_vrykul_skeleton::UpdateAI(), npc_ravenous_worg::npc_ravenous_worgAI::UpdateAI(), and WorldSession::VerifyMovementInfo().

◆ HasUnitFlag2()

◆ HasUnitMovementFlag()

◆ HasUnitState()

bool Unit::HasUnitState ( const uint32  f) const
inline
730{ return (m_state & f); }

References m_state.

Referenced by Spell::_cast(), Creature::_IsTargetAcceptable(), _IsValidAssistTarget(), _IsValidAttackTarget(), Player::ActivateTaxiPathTo(), AddThreat(), advisor_baseAI::advisor_baseAI(), Attack(), AttackerStateUpdate(), FollowerAI::AttackStart(), SmartAI::AttackStart(), npc_raging_spirit::npc_raging_spiritAI::AttackStart(), boss_alar::boss_alar(), boss_anetheron::boss_anetheron(), boss_anzu::boss_anzu(), boss_apothecary_hummel::boss_apothecary_hummelAI::boss_apothecary_hummelAI(), boss_archimonde::boss_archimonde(), boss_azgalor::boss_azgalor(), boss_azuregos::boss_azuregosAI::boss_azuregosAI(), boss_balinda::boss_balinda(), boss_bigbadwolf::boss_bigbadwolf(), boss_blackheart_the_inciter::boss_blackheart_the_inciter(), boss_blindeye_the_seer::boss_blindeye_the_seer(), boss_captain_skarloc::boss_captain_skarloc(), boss_curator::boss_curator(), boss_darkweaver_syth::boss_darkweaver_syth(), boss_dorothee::boss_dorothee(), boss_eck::boss_eck(), boss_exarch_maladaar::boss_exarch_maladaar(), boss_fathomguard_caribdis::boss_fathomguard_caribdis(), boss_fathomguard_sharkkis::boss_fathomguard_sharkkis(), boss_fathomguard_tidalvess::boss_fathomguard_tidalvess(), boss_ghazan::boss_ghazan(), boss_grand_warlock_nethekurse::boss_grand_warlock_nethekurse(), boss_halazzi::boss_halazzi(), boss_hexlord_malacrass::boss_hexlord_malacrass(), boss_high_astromancer_solarian::boss_high_astromancer_solarian(), boss_high_king_maulgar::boss_high_king_maulgar(), boss_janalai::boss_janalai(), boss_jarien::boss_jarien(), boss_kazrogal::boss_kazrogal(), boss_kelidan_the_breaker::boss_kelidan_the_breaker(), boss_kiggler_the_crazed::boss_kiggler_the_crazed(), boss_kiljaeden::boss_kiljaeden(), boss_krik_thir::boss_krik_thirAI::boss_krik_thirAI(), boss_krosh_firehand::boss_krosh_firehand(), boss_lady_vashj::boss_lady_vashj(), boss_magtheridon::boss_magtheridon(), boss_maiden_of_virtue::boss_maiden_of_virtue(), boss_mekgineer_steamrigger::boss_mekgineer_steamrigger(), boss_mennu_the_betrayer::boss_mennu_the_betrayer(), boss_mor_grayhoof::boss_mor_grayhoof(), boss_moroes::boss_moroes(), boss_morogrim_tidewalker::boss_morogrim_tidewalker(), boss_murmur::boss_murmur(), boss_nazan::boss_nazan(), boss_nexusprince_shaffar::boss_nexusprince_shaffar(), boss_olm_the_summoner::boss_olm_the_summoner(), boss_omor_the_unscarred::boss_omor_the_unscarred(), boss_pandemonius::boss_pandemonius(), boss_quagmirran::boss_quagmirran(), boss_rage_winterchill::boss_rage_winterchill(), boss_roar::boss_roar(), boss_rokmar_the_crackler::boss_rokmar_the_crackler(), boss_shirrak_the_dead_watcher::boss_shirrak_the_dead_watcher(), boss_sothos::boss_sothos(), boss_strawman::boss_strawman(), boss_supremus::boss_supremus(), boss_swamplord_muselek::boss_swamplord_muselek(), boss_taldaram::boss_taldaram(), boss_talon_king_ikiss::boss_talon_king_ikiss(), boss_tavarok::boss_tavarok(), boss_tenris_mirkblood::boss_tenris_mirkblood(), boss_terestian_illhoof::boss_terestian_illhoof(), boss_the_black_stalker::boss_the_black_stalker(), boss_the_maker::boss_the_maker(), boss_tinhead::boss_tinhead(), boss_vazruden::boss_vazruden(), boss_void_reaver::boss_void_reaver(), boss_warbringer_omrogg::boss_warbringer_omrogg(), boss_warchief_kargath_bladefist::boss_warchief_kargath_bladefist(), boss_watchkeeper_gargolmar::boss_watchkeeper_gargolmar(), PathGenerator::CalculatePath(), npc_q24545_wretched_ghoul::npc_q24545_wretched_ghoulAI::CanAIAttack(), boss_gurtogg_bloodboil::CanAIAttack(), PetAI::CanAttack(), Player::CanEquipItem(), CanFreeMove(), Creature::CanPeriodicallyCallForAssistance(), Creature::CanStartAttack(), spell_dk_death_grip::CheckCast(), Spell::CheckCast(), Spell::CheckPetCast(), spell_warr_retaliation::CheckProc(), SpellInfo::CheckTarget(), CreatureUnitRelocationWorker(), boss_garfrost::boss_garfrostAI::DamageTaken(), BossAI::DamageTaken(), boss_viscidus::DamageTaken(), boss_the_lich_king::boss_the_lich_kingAI::DamageTaken(), DealDamage(), DisableRotate(), UnitAI::DoCast(), UnitAI::DoCastAOE(), UnitAI::DoMeleeAttackIfReady(), boss_mandokir::boss_mandokirAI::DoMeleeAttackIfReady(), boss_ambassador_hellmaw::DoMeleeAttackIfReady(), UnitAI::DoSpellAttackIfReady(), UnitAI::DoSpellAttackToRandomTargetIfReady(), Spell::DoSpellHitOnUnit(), WaypointMovementGenerator< Creature >::DoUpdate(), RandomMovementGenerator< T >::DoUpdate(), Spell::EffectDistract(), Spell::EffectEnergize(), Spell::EffectHealMaxHealth(), Spell::EffectKnockBack(), CritterAI::EnterEvadeMode(), SmartAI::EnterEvadeMode(), npc_pet_mage_mirror_image::EnterEvadeMode(), Spell::finish(), Player::GetInitialVisiblePackets(), WorldSession::HandleAuctionListItems(), spell_dru_starfall_dummy::HandleDummy(), WorldSession::HandleEmoteOpcode(), WorldSession::HandleInitiateTradeOpcode(), WorldSession::HandleMoveTeleportAck(), AuraEffect::HandleObsModPowerAuraTick(), AuraEffect::HandlePeriodicDamageAurasTick(), AuraEffect::HandlePeriodicEnergizeAuraTick(), AuraEffect::HandlePeriodicHealAurasTick(), AuraEffect::HandlePeriodicHealthFunnelAuraTick(), AuraEffect::HandlePeriodicHealthLeechAuraTick(), AuraEffect::HandlePeriodicManaLeechAuraTick(), AuraEffect::HandlePeriodicPowerBurnAuraTick(), WorldSession::HandlePetCastSpellOpcode(), WorldSession::HandlePlayerLoginFromDB(), WorldSession::HandlePlayerLoginToCharInWorld(), AuraEffect::HandleProcTriggerDamageAuraProc(), ArenaSpectator::HandleSpectatorSpectateCommand(), boss_venoxis::InitializeAI(), isAttackingPlayer(), boss_faction_championsAI::IsCCed(), IsImmobilizedState(), Creature::IsInEvadeMode(), IsInFlight(), IsMovementPreventedByCasting(), Creature::IsMovementPreventedByCasting(), isPossessed(), isPossessedByPlayer(), ThreatContainer::IsPreferredTarget(), isSpellBlocked(), IsStopped(), isTargetableForAttack(), Creature::IsUpdateNeeded(), CritterAI::JustEngagedWith(), boss_priestess_delrissa::JustEngagedWith(), npc_coren_direbrew_sisters::JustEngagedWith(), boss_yoggsaron_keeper::JustEngagedWith(), boss_essence_of_desire::boss_essence_of_desireAI::JustEngagedWith(), boss_priestess_lackey_commonAI::JustEngagedWith(), boss_kagani_nightstrike::JustEngagedWith(), boss_novos::JustEngagedWith(), PetAI::KilledUnit(), CreatureGroup::LeaderMoveTo(), GridObjectLoader::LoadCreatures(), MagicSpellHitResult(), MeleeSpellHitResult(), FollowerAI::MoveInLineOfSight(), npc_escortAI::MoveInLineOfSight(), SmartAI::MoveInLineOfSight(), boss_kaelthas::MovementInform(), npc_toc_druid::npc_toc_druidAI::myCanCast(), npc_toc_shaman::npc_toc_shamanAI::myCanCast(), npc_toc_paladin::npc_toc_paladinAI::myCanCast(), npc_toc_priest::npc_toc_priestAI::myCanCast(), npc_toc_shadow_priest::npc_toc_shadow_priestAI::myCanCast(), npc_toc_warlock::npc_toc_warlockAI::myCanCast(), npc_toc_mage::npc_toc_mageAI::myCanCast(), npc_toc_hunter::npc_toc_hunterAI::myCanCast(), npc_toc_boomkin::npc_toc_boomkinAI::myCanCast(), npc_toc_warrior::npc_toc_warriorAI::myCanCast(), npc_toc_dk::npc_toc_dkAI::myCanCast(), npc_toc_rogue::npc_toc_rogueAI::myCanCast(), npc_toc_enh_shaman::npc_toc_enh_shamanAI::myCanCast(), npc_toc_retro_paladin::npc_toc_retro_paladinAI::myCanCast(), boss_twin_valkyrAI::myDoMeleeAttackIfReady(), npc_apothecary_baxter::npc_apothecary_baxter(), npc_batrider::npc_batrider(), npc_hyjal_frost_wyrm::npc_hyjal_frost_wyrm(), npc_hyjal_gargoyle::npc_hyjal_gargoyle(), npc_hyjal_ground_trash::npc_hyjal_ground_trash(), npc_icc_spire_frostwyrm::npc_icc_spire_frostwyrm(), npc_inner_demon::npc_inner_demon(), npc_kiljaeden_controller::npc_kiljaeden_controller(), npc_sunblade_arch_mage::npc_sunblade_arch_mage(), BossAI::OnSpellCastFinished(), Acore::FriendlyCCedInRange::operator()(), MysticBuffetTargetFilter::operator()(), SmartScript::ProcessAction(), RemoveCharmedBy(), boss_kormok::Reset(), boss_baroness_anastari::boss_baroness_anastariAI::Reset(), npc_ohgan::npc_ohganAI::Reset(), boss_thekal::Reset(), npc_zealot_lorkhan::Reset(), npc_zealot_zath::Reset(), boss_isalien::Reset(), npc_anubisath_guardian::Reset(), npc_ashtongue_channeler::Reset(), RollMeleeOutcomeAgainst(), boss_faction_championsAI::SelectEnemyCaster(), Player::SetClientControl(), SetContestedPvP(), SetControlled(), FollowerAI::SetFollowComplete(), FollowerAI::SetFollowPaused(), SetInCombatState(), SetInFront(), SetStunned(), WaypointMovementGenerator< Creature >::StartMove(), lfg::LFGMgr::TeleportPlayer(), CreatureAI::TriggerAlert(), Creature::Update(), Player::Update(), Update(), TimedFleeingMovementGenerator::Update(), boss_sartharion_dragonAI::UpdateAI(), CombatAI::UpdateAI(), CasterAI::UpdateAI(), BossAI::UpdateAI(), WorldBossAI::UpdateAI(), npc_av_marshal_or_warmaster::npc_av_marshal_or_warmasterAI::UpdateAI(), ironhand_guardian::ironhand_guardianAI::UpdateAI(), boss_anubshiah::boss_anubshiahAI::UpdateAI(), boss_emperor_dagran_thaurissan::boss_draganthaurissanAI::UpdateAI(), boss_eviscerator::boss_evisceratorAI::UpdateAI(), boss_gorosh_the_dervish::boss_gorosh_the_dervishAI::UpdateAI(), boss_grizzle::boss_grizzleAI::UpdateAI(), boss_hedrum::boss_hedrumAI::UpdateAI(), boss_moira_bronzebeardAI::UpdateAI(), boss_high_priestess_thaurissanAI::UpdateAI(), boss_okthor::boss_okthorAI::UpdateAI(), boss_drakkisath::boss_drakkisathAI::UpdateAI(), boss_halycon::boss_halyconAI::UpdateAI(), boss_highlord_omokk::boss_highlordomokkAI::UpdateAI(), boss_lord_valthalak::boss_lord_valthalakAI::UpdateAI(), boss_overlord_wyrmthalak::boss_overlordwyrmthalakAI::UpdateAI(), boss_quartermaster_zigris::UpdateAI(), boss_rend_blackhand::boss_rend_blackhandAI::UpdateAI(), npc_rookery_hatcher::npc_rookery_hatcherAI::UpdateAI(), boss_solakar_flamewreath::boss_solakar_flamewreathAI::UpdateAI(), boss_the_beast::boss_thebeastAI::UpdateAI(), boss_urok_doomhowl::boss_urok_doomhowlAI::UpdateAI(), npc_vaelastrasz_the_red::npc_vaelastrasz_the_redAI::UpdateAI(), boss_chromaggus::boss_chromaggusAI::UpdateAI(), boss_ebonroc::boss_ebonrocAI::UpdateAI(), boss_firemaw::boss_firemawAI::UpdateAI(), boss_flamegor::boss_flamegorAI::UpdateAI(), boss_victor_nefarius::boss_victor_nefariusAI::UpdateAI(), boss_nefarian::UpdateAI(), boss_razorgore::boss_razorgoreAI::UpdateAI(), boss_vaelastrasz::boss_vaelAI::UpdateAI(), boss_garr::boss_garrAI::UpdateAI(), boss_golemagg::boss_golemaggAI::UpdateAI(), npc_core_rager::npc_core_ragerAI::UpdateAI(), boss_majordomo::boss_majordomoAI::UpdateAI(), boss_ragnaros::boss_ragnarosAI::UpdateAI(), npc_flamewaker_priest::npc_flamewaker_priestAI::UpdateAI(), npc_mc_core_hound::npc_mc_core_houndAI::UpdateAI(), boss_netherspite::UpdateAI(), boss_servant_quarters::UpdateAI(), npc_kilrek::UpdateAI(), boss_priestess_lackey_commonAI::UpdateAI(), boss_darkmaster_gandling::boss_darkmaster_gandlingAI::UpdateAI(), boss_kirtonos_the_herald::boss_kirtonos_the_heraldAI::UpdateAI(), npc_scholomance_occultist::npc_scholomance_occultistAI::UpdateAI(), npc_bh_thalorien_dawnseeker::npc_bh_thalorien_dawnseekerAI::UpdateAI(), npc_lady_sylvanas_windrunner::npc_lady_sylvanas_windrunnerAI::UpdateAI(), npc_varian_wrynn::npc_varian_wrynnAI::UpdateAI(), npc_jaina_proudmoore_bfu::npc_jaina_proudmoore_bfuAI::UpdateAI(), boss_blight_worm::boss_blight_wormAI::UpdateAI(), npc_thrall_bfu::npc_thrall_bfuAI::UpdateAI(), npc_lady_sylvanas_windrunner_bfu::npc_lady_sylvanas_windrunner_bfuAI::UpdateAI(), boss_arlokk::boss_arlokkAI::UpdateAI(), boss_grilek::boss_grilekAI::UpdateAI(), boss_hakkar::boss_hakkarAI::UpdateAI(), boss_hazzarah::UpdateAI(), boss_jindo::UpdateAI(), boss_mandokir::boss_mandokirAI::UpdateAI(), boss_renataki::boss_renatakiAI::UpdateAI(), boss_wushoolay::boss_wushoolayAI::UpdateAI(), npc_coren_direbrew::UpdateAI(), npc_hallows_end_soh::UpdateAI(), boss_headless_horseman::UpdateAI(), boss_epoch::boss_epochAI::UpdateAI(), boss_infinite_corruptor::boss_infinite_corruptorAI::UpdateAI(), boss_mal_ganis::boss_mal_ganisAI::UpdateAI(), boss_meathook::boss_meathookAI::UpdateAI(), boss_salramm::boss_salrammAI::UpdateAI(), npc_arthas::npc_arthasAI::UpdateAI(), boss_lieutenant_drake::UpdateAI(), boss_onyxia::UpdateAI(), npc_onyxian_lair_guard::UpdateAI(), npc_belnistrasz::npc_belnistraszAI::UpdateAI(), npc_shadowpriest_sezziz::npc_shadowpriest_sezzizAI::UpdateAI(), boss_elder_nadox::UpdateAI(), boss_jedoga_shadowseeker::UpdateAI(), boss_anub_arak::UpdateAI(), boss_hadronox::UpdateAI(), boss_sartharion::UpdateAI(), boss_baltharus_the_warborn::boss_baltharus_the_warbornAI::UpdateAI(), npc_baltharus_the_warborn_clone::npc_baltharus_the_warborn_cloneAI::UpdateAI(), boss_general_zarithrian::boss_general_zarithrianAI::UpdateAI(), boss_halion::boss_halionAI::UpdateAI(), boss_twilight_halion::boss_twilight_halionAI::UpdateAI(), boss_saviana_ragefire::boss_saviana_ragefireAI::UpdateAI(), boss_eadric::boss_eadricAI::UpdateAI(), boss_paletress::boss_paletressAI::UpdateAI(), npc_memory::npc_memoryAI::UpdateAI(), npc_argent_soldier::npc_argent_soldierAI::UpdateAI(), boss_black_knight::boss_black_knightAI::UpdateAI(), npc_black_knight_ghoul::npc_black_knight_ghoulAI::UpdateAI(), npc_toc5_grand_champion_minion::npc_toc5_grand_champion_minionAI::UpdateAI(), boss_grand_champion::boss_grand_championAI::UpdateAI(), boss_anubarak_trial::boss_anubarak_trialAI::UpdateAI(), npc_nerubian_burrower::npc_nerubian_burrowerAI::UpdateAI(), npc_anubarak_spike::npc_anubarak_spikeAI::UpdateAI(), npc_toc_hunter::npc_toc_hunterAI::UpdateAI(), boss_jaraxxus::boss_jaraxxusAI::UpdateAI(), npc_fel_infernal::npc_fel_infernalAI::UpdateAI(), npc_mistress_of_pain::npc_mistress_of_painAI::UpdateAI(), npc_snobold_vassal::npc_snobold_vassalAI::UpdateAI(), boss_gormok::boss_gormokAI::UpdateAI(), boss_jormungarAI::UpdateAI(), boss_icehowl::boss_icehowlAI::UpdateAI(), boss_twin_valkyrAI::UpdateAI(), boss_tharon_ja::boss_tharon_jaAI::UpdateAI(), boss_trollgore::boss_trollgoreAI::UpdateAI(), boss_bronjahm::boss_bronjahmAI::UpdateAI(), npc_fos_corrupted_soul_fragment::npc_fos_corrupted_soul_fragmentAI::UpdateAI(), boss_devourer_of_souls::boss_devourer_of_soulsAI::UpdateAI(), boss_falric::boss_falricAI::UpdateAI(), boss_marwyn::boss_marwynAI::UpdateAI(), npc_ghostly_priest::npc_ghostly_priestAI::UpdateAI(), npc_phantom_mage::npc_phantom_mageAI::UpdateAI(), npc_shadowy_mercenary::npc_shadowy_mercenaryAI::UpdateAI(), npc_spectral_footman::npc_spectral_footmanAI::UpdateAI(), npc_tortured_rifleman::npc_tortured_riflemanAI::UpdateAI(), boss_frostsworn_general::boss_frostsworn_generalAI::UpdateAI(), npc_hor_spiritual_reflection::npc_hor_spiritual_reflectionAI::UpdateAI(), npc_hor_risen_witch_doctor::npc_hor_risen_witch_doctorAI::UpdateAI(), npc_hor_lumbering_abomination::npc_hor_lumbering_abominationAI::UpdateAI(), boss_garfrost::boss_garfrostAI::UpdateAI(), boss_ick::boss_ickAI::UpdateAI(), boss_tyrannus::boss_tyrannusAI::UpdateAI(), npc_pos_deathwhisper_necrolyte::npc_pos_deathwhisper_necrolyteAI::UpdateAI(), boss_drakkari_elemental::boss_drakkari_elementalAI::UpdateAI(), npc_living_mojo::npc_living_mojoAI::UpdateAI(), boss_moorabi::boss_moorabiAI::UpdateAI(), boss_prince_keleseth_icc::boss_prince_kelesethAI::UpdateAI(), boss_prince_taldaram_icc::boss_prince_taldaramAI::UpdateAI(), boss_prince_valanar_icc::boss_prince_valanarAI::UpdateAI(), boss_blood_queen_lana_thel::boss_blood_queen_lana_thelAI::UpdateAI(), boss_deathbringer_saurfang::boss_deathbringer_saurfangAI::UpdateAI(), boss_festergut::boss_festergutAI::UpdateAI(), npc_stinky_icc::npc_stinky_iccAI::UpdateAI(), npc_high_overlord_saurfang_igb::npc_high_overlord_saurfang_igbAI::UpdateAI(), npc_muradin_bronzebeard_igb::npc_muradin_bronzebeard_igbAI::UpdateAI(), npc_gunship_boarding_leader::npc_gunship_boarding_leaderAI::UpdateAI(), npc_gunship_boarding_add::npc_gunship_boarding_add_realAI::UpdateAI(), npc_gunship_gunner::npc_gunship_gunnerAI::UpdateAI(), boss_lady_deathwhisper::boss_lady_deathwhisperAI::UpdateAI(), npc_cult_fanatic::npc_cult_fanaticAI::UpdateAI(), npc_cult_adherent::npc_cult_adherentAI::UpdateAI(), npc_darnavan::npc_darnavanAI::UpdateAI(), boss_lord_marrowgar::UpdateAI(), boss_professor_putricide::boss_professor_putricideAI::UpdateAI(), npc_putricide_oozeAI::UpdateAI(), boss_rotface::boss_rotfaceAI::UpdateAI(), npc_precious_icc::npc_precious_iccAI::UpdateAI(), boss_sindragosa::boss_sindragosaAI::UpdateAI(), npc_spinestalker::npc_spinestalkerAI::UpdateAI(), npc_rimefang::npc_rimefangAI::UpdateAI(), npc_sindragosa_trash::npc_sindragosa_trashAI::UpdateAI(), boss_the_lich_king::boss_the_lich_kingAI::UpdateAI(), npc_tirion_fordring_tft::npc_tirion_fordringAI::UpdateAI(), npc_shambling_horror_icc::npc_shambling_horror_iccAI::UpdateAI(), npc_raging_spirit::npc_raging_spiritAI::UpdateAI(), npc_valkyr_shadowguard::npc_valkyr_shadowguardAI::UpdateAI(), boss_valithria_dreamwalker::boss_valithria_dreamwalkerAI::UpdateAI(), npc_the_lich_king_controller::npc_the_lich_king_controllerAI::UpdateAI(), npc_risen_archmage::npc_risen_archmageAI::UpdateAI(), npc_blazing_skeleton::npc_blazing_skeletonAI::UpdateAI(), npc_gluttonous_abomination::npc_gluttonous_abominationAI::UpdateAI(), npc_rotting_frost_giant::npc_rotting_frost_giantAI::UpdateAI(), npc_crok_scourgebane::npc_crok_scourgebaneAI::UpdateAI(), boss_sister_svalna::boss_sister_svalnaAI::UpdateAI(), npc_captain_arnath::npc_captain_arnathAI::UpdateAI(), npc_captain_brandon::npc_captain_brandonAI::UpdateAI(), npc_captain_grondel::npc_captain_grondelAI::UpdateAI(), npc_captain_rupert::npc_captain_rupertAI::UpdateAI(), npc_frostwing_vrykul::npc_frostwing_vrykulAI::UpdateAI(), npc_icc_skybreaker_hierophant::npc_icc_skybreaker_hierophantAI::UpdateAI(), npc_icc_skybreaker_marksman::npc_icc_skybreaker_marksmanAI::UpdateAI(), npc_icc_skybreaker_vicar::npc_icc_skybreaker_vicarAI::UpdateAI(), npc_icc_skybreaker_luminary::npc_icc_skybreaker_luminaryAI::UpdateAI(), npc_icc_valkyr_herald::npc_icc_valkyr_heraldAI::UpdateAI(), npc_icc_severed_essence::npc_icc_severed_essenceAI::UpdateAI(), npc_icc_vengeful_fleshreaper::npc_icc_vengeful_fleshreaperAI::UpdateAI(), npc_icc_nerubar_broodkeeper::npc_icc_nerubar_broodkeeperAI::UpdateAI(), boss_isle_of_conquest::boss_isle_of_conquestAI::UpdateAI(), boss_four_horsemen::boss_four_horsemenAI::UpdateAI(), boss_gluth::boss_gluthAI::UpdateAI(), boss_gothik::boss_gothikAI::UpdateAI(), boss_grobbulus::boss_grobbulusAI::UpdateAI(), boss_kelthuzad::boss_kelthuzadAI::UpdateAI(), boss_kelthuzad_minion::boss_kelthuzad_minionAI::UpdateAI(), boss_loatheb::boss_loathebAI::UpdateAI(), boss_maexxna::boss_maexxnaAI::UpdateAI(), boss_noth::boss_nothAI::UpdateAI(), boss_patchwerk::boss_patchwerkAI::UpdateAI(), boss_razuvious_minion::boss_razuvious_minionAI::UpdateAI(), boss_sapphiron::boss_sapphironAI::UpdateAI(), boss_thaddius::boss_thaddiusAI::UpdateAI(), boss_thaddius_summon::boss_thaddius_summonAI::UpdateAI(), boss_malygos::UpdateAI(), npc_nexus_lord::UpdateAI(), npc_scion_of_eternity::UpdateAI(), boss_anomalus::UpdateAI(), boss_keristrasza::UpdateAI(), boss_magus_telestra::UpdateAI(), boss_ormorok::UpdateAI(), boss_drakos::boss_drakosAI::UpdateAI(), boss_eregos::boss_eregosAI::UpdateAI(), boss_urom::boss_uromAI::UpdateAI(), boss_varos::boss_varosAI::UpdateAI(), npc_stormforged_lieutenant::UpdateAI(), boss_ionar::UpdateAI(), boss_volkhan::UpdateAI(), npc_molten_golem::UpdateAI(), boss_krystallus::boss_krystallusAI::UpdateAI(), boss_maiden_of_grief::boss_maiden_of_griefAI::UpdateAI(), boss_sjonnir_iron_sludge::boss_sjonnir_iron_sludgeAI::UpdateAI(), boss_algalon_the_observer::UpdateAI(), boss_steelbreaker::UpdateAI(), boss_runemaster_molgeim::UpdateAI(), boss_stormcaller_brundir::UpdateAI(), npc_auriaya_sanctum_sentry::UpdateAI(), npc_auriaya_feral_defender::UpdateAI(), boss_flame_leviathan::UpdateAI(), boss_freya::UpdateAI(), boss_freya_elder_stonebark::UpdateAI(), boss_freya_elder_brightleaf::UpdateAI(), boss_freya_elder_ironbranch::UpdateAI(), boss_freya_summons::UpdateAI(), boss_vezax::UpdateAI(), boss_hodir::UpdateAI(), npc_ulduar_hodir_priest::UpdateAI(), npc_ulduar_hodir_druid::UpdateAI(), npc_ulduar_hodir_shaman::UpdateAI(), npc_ulduar_hodir_mage::UpdateAI(), boss_ignis::UpdateAI(), boss_kologarn::UpdateAI(), npc_ulduar_leviathan_mkii::UpdateAI(), npc_ulduar_vx001::UpdateAI(), npc_ulduar_aerial_command_unit::UpdateAI(), boss_razorscale::UpdateAI(), boss_thorim::UpdateAI(), boss_thorim_sif::UpdateAI(), boss_thorim_start_npcs::UpdateAI(), boss_thorim_gauntlet_npcs::UpdateAI(), boss_thorim_runic_colossus::UpdateAI(), boss_thorim_ancient_rune_giant::UpdateAI(), boss_thorim_arena_npcs::UpdateAI(), boss_xt002::UpdateAI(), boss_yoggsaron_sara::UpdateAI(), boss_yoggsaron::UpdateAI(), boss_yoggsaron_constrictor_tentacle::UpdateAI(), boss_yoggsaron_immortal_guardian::UpdateAI(), npc_ulduar_storm_tempered_keeper::UpdateAI(), npc_ulduar_arachnopod_destroyer::UpdateAI(), boss_ingvar_the_plunderer::UpdateAI(), npc_vrykul_skeleton::UpdateAI(), boss_skarvald_the_constructor::UpdateAI(), boss_dalronn_the_controller::UpdateAI(), npc_enslaved_proto_drake::UpdateAI(), npc_massive_jormungar::npc_massive_jormungarAI::UpdateAI(), npc_ferocious_rhino::npc_ferocious_rhinoAI::UpdateAI(), npc_ravenous_furbolg::npc_ravenous_furbolgAI::UpdateAI(), npc_frenzied_worgen::npc_frenzied_worgenAI::UpdateAI(), boss_skadi::boss_skadiAI::UpdateAI(), boss_svala::boss_svalaAI::UpdateAI(), boss_ymiron::boss_ymironAI::UpdateAI(), boss_archavon::boss_archavonAI::UpdateAI(), boss_emalon::boss_emalonAI::UpdateAI(), boss_koralon::boss_koralonAI::UpdateAI(), boss_toravon::boss_toravonAI::UpdateAI(), boss_cyanigosa::boss_cyanigosaAI::UpdateAI(), boss_erekem::boss_erekemAI::UpdateAI(), npc_erekem_guard::npc_erekem_guardAI::UpdateAI(), boss_lavanthor::boss_lavanthorAI::UpdateAI(), boss_moragg::boss_moraggAI::UpdateAI(), boss_xevozz::boss_xevozzAI::UpdateAI(), boss_zuramat::boss_zuramatAI::UpdateAI(), npc_dalaran_mage::npc_dalaran_mageAI::UpdateAI(), npc_q24545_vegard::npc_q24545_vegardAI::UpdateAI(), npc_tournament_training_dummy::npc_tournament_training_dummyAI::UpdateAI(), npc_overlord_drakuru_betrayal::UpdateAI(), boss_exarch_maladaar::UpdateAI(), boss_nexusprince_shaffar::UpdateAI(), npc_yor::UpdateAI(), boss_anzu::UpdateAI(), npc_maiev_illidan::UpdateAI(), boss_gathios_the_shatterer::UpdateAI(), boss_high_nethermancer_zerevor::UpdateAI(), boss_lady_malande::UpdateAI(), boss_veras_darkshadow::UpdateAI(), boss_essence_of_suffering::boss_essence_of_sufferingAI::UpdateAI(), boss_essence_of_desire::boss_essence_of_desireAI::UpdateAI(), boss_essence_of_anger::boss_essence_of_angerAI::UpdateAI(), boss_doomlord_kazzak::boss_doomlordkazzakAI::UpdateAI(), boss_doomwalker::UpdateAI(), boss_leotheras_the_blind::UpdateAI(), boss_gruul::UpdateAI(), boss_omor_the_unscarred::UpdateAI(), boss_watchkeeper_gargolmar::UpdateAI(), boss_grand_warlock_nethekurse::UpdateAI(), npc_millhouse_manastorm::npc_millhouse_manastormAI::UpdateAI(), boss_alar::UpdateAI(), advisor_baseAI::UpdateAI(), npc_maghar_captive::npc_maghar_captiveAI::UpdateAI(), npc_enslaved_netherwing_drake::UpdateAI(), npc_dragonmaw_peon::npc_dragonmaw_peonAI::UpdateAI(), npc_pet_dk_ebon_gargoyle::UpdateAI(), npc_pet_gen_target_following_bomb::UpdateAI(), npc_pet_mage_mirror_image::UpdateAI(), emerald_dragonAI::UpdateAI(), npc_artorius::npc_artoriusAI::UpdateAI(), npc_simone::npc_simoneAI::UpdateAI(), npc_nelson::npc_nelsonAI::UpdateAI(), npc_franklin::npc_franklinAI::UpdateAI(), npc_target_dummy::npc_target_dummyAI::UpdateAI(), PetAI::UpdateAI(), npc_orb_carrier::npc_orb_carrierAI::UpdateAI(), npc_hor_raging_ghoul::npc_hor_raging_ghoulAI::UpdateAI(), npc_gunship_rocketeer::npc_gunship_rocketeerAI::UpdateAI(), npc_suppresser::npc_suppresserAI::UpdateAI(), boss_yoggsaron_crusher_tentacle::UpdateAI(), boss_yoggsaron_corruptor_tentacle::UpdateAI(), npc_wg_spirit_guide::npc_wg_spirit_guideAI::UpdateAI(), Player::UpdateCharmedAI(), npc_general_andorov::UpdateEscortAI(), npc_onyx_flamecaller::npc_onyx_flamecallerAI::UpdateEscortAI(), boss_bjarngrim::UpdateEscortAI(), npc_kurenai_captive::npc_kurenai_captiveAI::UpdateEscortAI(), npc_isla_starmane::npc_isla_starmaneAI::UpdateEscortAI(), SmartAI::UpdatePath(), and SmartScript::UpdateTimer().

◆ HasUnitTypeMask()

◆ HasVisibleAuraType()

bool Unit::HasVisibleAuraType ( AuraType  auraType) const
5968{
5969 AuraEffectList const& mAuraList = GetAuraEffectsByType(auraType);
5970 for (AuraEffectList::const_iterator i = mAuraList.begin(); i != mAuraList.end(); ++i)
5971 if ((*i)->GetBase()->CanBeSentToClient())
5972 return true;
5973
5974 return false;
5975}

References GetAuraEffectsByType().

◆ HasWaterBreathingAura()

bool Unit::HasWaterBreathingAura ( ) const
inline
@ SPELL_AURA_WATER_BREATHING
Definition SpellAuraDefines.h:145

References HasAuraType(), and SPELL_AURA_WATER_BREATHING.

Referenced by Player::getMaxTimer().

◆ HasWaterWalkAura()

bool Unit::HasWaterWalkAura ( ) const
inline
@ SPELL_AURA_WATER_WALK
Definition SpellAuraDefines.h:167

References HasAuraType(), and SPELL_AURA_WATER_WALK.

◆ HasWeapon()

virtual bool Unit::HasWeapon ( WeaponAttackType  type) const
pure virtual

Implemented in Creature, and Player.

Referenced by HasMainhandWeapon(), HasOffhandWeapon(), and HasRangedWeapon().

◆ HasWeaponForAttack()

virtual bool Unit::HasWeaponForAttack ( WeaponAttackType  type) const
inlinevirtual

Reimplemented in Creature, and Player.

977{ return CanUseAttackType(type); }
bool CanUseAttackType(WeaponAttackType attacktype) const
Definition Unit.h:981

References CanUseAttackType().

Referenced by hasMainhandWeaponForAttack(), HasMainhandWeaponForAttack(), HasOffhandWeaponForAttack(), HasRangedWeaponForAttack(), Creature::HasWeaponForAttack(), and Player::HasWeaponForAttack().

◆ haveOffhandWeapon()

bool Unit::haveOffhandWeapon ( ) const
631{
632 if (Player const* player = ToPlayer())
633 return player->GetWeaponForAttack(OFF_ATTACK, true);
634
635 return CanDualWield();
636}
bool CanDualWield() const
Definition Unit.h:967

References CanDualWield(), OFF_ATTACK, and Object::ToPlayer().

Referenced by boss_mandokir::boss_mandokirAI::DoMeleeAttackIfReady(), boss_ambassador_hellmaw::DoMeleeAttackIfReady(), spell_dk_threat_of_thassarian::HandleProc(), and boss_twin_valkyrAI::myDoMeleeAttackIfReady().

◆ HealBySpell()

int32 Unit::HealBySpell ( HealInfo healInfo,
bool  critical = false 
)
8237{
8238 uint32 heal = healInfo.GetHeal();
8239 sScriptMgr->ModifyHealReceived(this, healInfo.GetTarget(), heal, healInfo.GetSpellInfo());
8240 healInfo.SetHeal(heal);
8241
8242 // calculate heal absorb and reduce healing
8243 CalcHealAbsorb(healInfo);
8244
8245 int32 gain = Unit::DealHeal(healInfo.GetHealer(), healInfo.GetTarget(), healInfo.GetHeal());
8246 healInfo.SetEffectiveHeal(gain);
8247
8248 SendHealSpellLog(healInfo, critical);
8249 return gain;
8250}
Unit * GetHealer() const
Definition Unit.h:422
void SetHeal(uint32 amount)
Definition Unit.h:412
void SetEffectiveHeal(uint32 amount)
Definition Unit.h:417
static void CalcHealAbsorb(HealInfo &healInfo)
Definition Unit.cpp:2632
static int32 DealHeal(Unit *healer, Unit *victim, uint32 addhealth)
Definition Unit.cpp:7946
void SendHealSpellLog(HealInfo const &healInfo, bool critical=false)
Definition Unit.cpp:8219

References CalcHealAbsorb(), DealHeal(), HealInfo::GetHeal(), HealInfo::GetHealer(), HealInfo::GetSpellInfo(), HealInfo::GetTarget(), SendHealSpellLog(), HealInfo::SetEffectiveHeal(), HealInfo::SetHeal(), and sScriptMgr.

Referenced by Spell::DoAllEffectOnTarget(), AuraEffect::HandlePeriodicHealthFunnelAuraTick(), AuraEffect::HandlePeriodicHealthLeechAuraTick(), and AuraEffect::HandlePeriodicTriggerSpellAuraTick().

◆ HealthAbovePct()

◆ HealthAbovePctHealed()

bool Unit::HealthAbovePctHealed ( int32  pct,
uint32  heal 
) const
inline

◆ HealthBelowPct()

bool Unit::HealthBelowPct ( int32  pct) const
inline
1105{ return GetHealth() < CountPctFromMaxHealth(pct); }

References CountPctFromMaxHealth(), and GetHealth().

Referenced by boss_moira_bronzebeardAI::CastOnEmperorIfPossible(), spell_dru_glyph_of_rejuvenation::CheckProc(), spell_warr_t3_prot_8p_bonus::CheckProc(), boss_mor_grayhoof::DamageTaken(), boss_isalien::DamageTaken(), boss_viscidus::DamageTaken(), boss_thorim_start_npcs::DamageTaken(), npc_infra_green_bomber_generic::npc_infra_green_bomber_genericAI::DamageTaken(), boss_hadronox::DamageTaken(), AuraEffect::HandlePeriodicDamageAurasTick(), AuraEffect::HandlePeriodicDummyAuraTick(), ScriptedAI::HealthBelowPct(), boss_kalec::JustEngagedWith(), boss_sathrovarr::JustEngagedWith(), npc_akama_illidan::JustEngagedWith(), npc_maiev_illidan::JustEngagedWith(), boss_olm_the_summoner::JustEngagedWith(), boss_priestess_lackey_commonAI::JustEngagedWith(), boss_yazzai::JustEngagedWith(), boss_grand_warlock_nethekurse::JustEngagedWith(), Player::LoadFromDB(), npc_death_knight_initiate::OnGossipHello(), npc_wild_wyrm::PassengerBoarded(), SetHealth(), SpellPctHealingModsDone(), Update(), boss_mr_smite::boss_mr_smiteAI::UpdateAI(), npc_death_knight_initiate::npc_death_knight_initiateAI::UpdateAI(), npc_scholomance_occultist::npc_scholomance_occultistAI::UpdateAI(), npc_sentinel_leader::UpdateAI(), npc_sentinel_infiltrator::UpdateAI(), boss_baltharus_the_warborn::boss_baltharus_the_warbornAI::UpdateAI(), boss_halion::boss_halionAI::UpdateAI(), boss_twilight_halion::boss_twilight_halionAI::UpdateAI(), npc_hor_lich_king::npc_hor_lich_kingAI::UpdateAI(), boss_drakkari_colossus::boss_drakkari_colossusAI::UpdateAI(), boss_drakkari_elemental::boss_drakkari_elementalAI::UpdateAI(), boss_gothik::boss_gothikAI::UpdateAI(), boss_kelthuzad::boss_kelthuzadAI::UpdateAI(), boss_kelthuzad_minion::boss_kelthuzad_minionAI::UpdateAI(), boss_sapphiron::boss_sapphironAI::UpdateAI(), boss_anomalus::UpdateAI(), boss_keristrasza::UpdateAI(), boss_magus_telestra::UpdateAI(), boss_ormorok::UpdateAI(), boss_xt002::UpdateAI(), boss_yoggsaron_immortal_guardian::UpdateAI(), npc_iron_watcher::npc_iron_watcherAI::UpdateAI(), boss_grand_warlock_nethekurse::UpdateAI(), and npc_thrall_old_hillsbrad::npc_thrall_old_hillsbradAI::UpdateEscortAI().

◆ HealthBelowPctDamaged()

bool Unit::HealthBelowPctDamaged ( int32  pct,
uint32  damage 
) const
inline
1106{ return int64(GetHealth()) - int64(damage) < int64(CountPctFromMaxHealth(pct)); }
std::int64_t int64
Definition Define.h:102

References CountPctFromMaxHealth(), and GetHealth().

Referenced by boss_mandokir::boss_mandokirAI::DamageDealt(), boss_lord_valthalak::boss_lord_valthalakAI::DamageTaken(), npc_blackhand_incarcerator::npc_blackhand_incarceratorAI::DamageTaken(), boss_quartermaster_zigris::DamageTaken(), boss_warmaster_voone::boss_warmastervooneAI::DamageTaken(), boss_baron_geddon::boss_baron_geddonAI::DamageTaken(), boss_golemagg::boss_golemaggAI::DamageTaken(), npc_core_rager::npc_core_ragerAI::DamageTaken(), boss_attumen::DamageTaken(), boss_midnight::DamageTaken(), boss_kormok::DamageTaken(), npc_batrider::DamageTaken(), npc_coren_direbrew::DamageTaken(), boss_headless_horseman_head::DamageTaken(), boss_onyxia::DamageTaken(), npc_anubisath_guardian::DamageTaken(), boss_ouro::DamageTaken(), npc_anubisath_sentinel::aqsentinelAI::DamageTaken(), npc_anubisath_defender::DamageTaken(), boss_elder_nadox::DamageTaken(), boss_jedoga_shadowseeker::DamageTaken(), npc_anub_ar_crusher::DamageTaken(), boss_sartharion::DamageTaken(), boss_bronjahm::boss_bronjahmAI::DamageTaken(), npc_gunship::npc_gunshipAI::DamageTaken(), npc_high_overlord_saurfang_igb::npc_high_overlord_saurfang_igbAI::DamageTaken(), npc_muradin_bronzebeard_igb::npc_muradin_bronzebeard_igbAI::DamageTaken(), npc_gunship_boarding_addAI::DamageTaken(), npc_shambling_horror_icc::npc_shambling_horror_iccAI::DamageTaken(), npc_valkyr_shadowguard::npc_valkyr_shadowguardAI::DamageTaken(), boss_valithria_dreamwalker::boss_valithria_dreamwalkerAI::DamageTaken(), boss_algalon_the_observer::DamageTaken(), npc_xt002_boombot::DamageTaken(), npc_ulduar_arachnopod_destroyer::DamageTaken(), npc_akama_shade::DamageTaken(), boss_vazruden::DamageTaken(), npc_millhouse_manastorm::npc_millhouse_manastormAI::DamageTaken(), npc_magister_aledis::DamageTaken(), BossAI::DamageTaken(), boss_halazzi::DamageTaken(), boss_malygos::DamageTaken(), boss_buru::DamageTaken(), npc_unkor_the_ruthless::npc_unkor_the_ruthlessAI::DamageTaken(), boss_bug_trio::DamageTaken(), boss_hadronox::DamageTaken(), boss_yoggsaron_brain::DamageTaken(), and spell_warl_seed_of_corruption_dummy::HandleProc().

◆ IncrDiminishing()

void Unit::IncrDiminishing ( DiminishingGroup  group)
11914{
11915 // Checking for existing in the table
11916 for (Diminishing::iterator i = m_Diminishing.begin(); i != m_Diminishing.end(); ++i)
11917 {
11918 if (i->DRGroup != group)
11919 continue;
11920 if (int32(i->hitCount) < GetDiminishingReturnsMaxLevel(group))
11921 i->hitCount += 1;
11922 return;
11923 }
11925}
DiminishingLevels GetDiminishingReturnsMaxLevel(DiminishingGroup group)
Definition SpellMgr.cpp:261
Definition Unit.h:279

References DIMINISHING_LEVEL_2, GetDiminishingReturnsMaxLevel(), GameTime::GetGameTimeMS(), and m_Diminishing.

Referenced by Spell::DoSpellHitOnUnit().

◆ InitCharmInfo()

CharmInfo * Unit::InitCharmInfo ( )
12808{
12809 if (!m_charmInfo)
12810 m_charmInfo = new CharmInfo(this);
12811
12812 return m_charmInfo;
12813}
Definition CharmInfo.h:127

References m_charmInfo.

Referenced by Guardian::Guardian(), Pet::Pet(), and SetCharmedBy().

◆ InitStatBuffMods()

void Unit::InitStatBuffMods ( )
inline
1059 {
1060 for (uint8 i = STAT_STRENGTH; i < MAX_STATS; ++i) SetFloatValue(static_cast<uint16>(UNIT_FIELD_POSSTAT0) + i, 0);
1061 for (uint8 i = STAT_STRENGTH; i < MAX_STATS; ++i) SetFloatValue(static_cast<uint16>(UNIT_FIELD_NEGSTAT0) + i, 0);
1062 }

References STAT_STRENGTH, UNIT_FIELD_NEGSTAT0, and UNIT_FIELD_POSSTAT0.

Referenced by Player::InitStatsForLevel().

◆ InitTamedPet()

bool Unit::InitTamedPet ( Pet pet,
uint8  level,
uint32  spell_id 
)
13910{
13911 Player* player = ToPlayer();
13912 PetStable& petStable = player->GetOrInitPetStable();
13913 if (petStable.CurrentPet || petStable.GetUnslottedHunterPet())
13914 return false;
13915
13916 pet->SetCreatorGUID(GetGUID());
13917 pet->SetFaction(GetFaction());
13918 pet->SetUInt32Value(UNIT_CREATED_BY_SPELL, spell_id);
13919
13920 if (IsPlayer())
13922
13923 if (!pet->InitStatsForLevel(level))
13924 {
13925 LOG_ERROR("entities.unit", "Pet::InitStatsForLevel() failed for creature (Entry: {})!", pet->GetEntry());
13926 return false;
13927 }
13928
13929 pet->GetCharmInfo()->SetPetNumber(sObjectMgr->GeneratePetNumber(), true);
13930 // this enables pet details window (Shift+P)
13931 pet->InitPetCreateSpells();
13932 pet->SetFullHealth();
13933 pet->FillPetInfo(&petStable.CurrentPet.emplace());
13934 return true;
13935}
@ UNIT_CREATED_BY_SPELL
Definition UpdateFields.h:138
bool InitStatsForLevel(uint8 level)
Definition Pet.cpp:1018
Definition PetDefines.h:212
PetInfo const * GetUnslottedHunterPet() const
Definition PetDefines.h:240
Optional< PetInfo > CurrentPet
Definition PetDefines.h:235
void FillPetInfo(PetStable::PetInfo *petInfo) const
Definition Pet.cpp:2459
void InitPetCreateSpells()
Definition Pet.cpp:2034
PetStable & GetOrInitPetStable()
Definition Player.cpp:15667
void SetFullHealth()
Definition Unit.h:1115
void SetFaction(uint32 faction)
Definition Unit.cpp:7020
void ReplaceAllUnitFlags(UnitFlags flags)
Remove the Unit flag specify only.
Definition Unit.h:744
CharmInfo * GetCharmInfo()
Definition Unit.h:1270
void SetCreatorGUID(ObjectGuid creator)
Definition Unit.h:710
void SetPetNumber(uint32 petnumber, bool statwindow)
Definition CharmInfo.cpp:240

References PetStable::CurrentPet, Pet::FillPetInfo(), GetCharmInfo(), Object::GetEntry(), GetFaction(), Object::GetGUID(), Player::GetOrInitPetStable(), PetStable::GetUnslottedHunterPet(), Pet::InitPetCreateSpells(), Guardian::InitStatsForLevel(), Object::IsPlayer(), LOG_ERROR, ReplaceAllUnitFlags(), SetCreatorGUID(), SetFaction(), SetFullHealth(), CharmInfo::SetPetNumber(), SetUInt32Value(), sObjectMgr, Object::ToPlayer(), UNIT_CREATED_BY_SPELL, and UNIT_FLAG_PLAYER_CONTROLLED.

Referenced by CreateTamedPetFrom(), and CreateTamedPetFrom().

◆ InterruptNonMeleeSpells()

void Unit::InterruptNonMeleeSpells ( bool  withDelayed,
uint32  spellid = 0,
bool  withInstant = true,
bool  bySelf = false 
)
4273{
4274 // generic spells are interrupted if they are not finished or delayed
4275 if (m_currentSpells[CURRENT_GENERIC_SPELL] && (!spell_id || m_currentSpells[CURRENT_GENERIC_SPELL]->m_spellInfo->Id == spell_id))
4276 InterruptSpell(CURRENT_GENERIC_SPELL, withDelayed, withInstant, bySelf);
4277
4278 // autorepeat spells are interrupted if they are not finished or delayed
4279 if (m_currentSpells[CURRENT_AUTOREPEAT_SPELL] && (!spell_id || m_currentSpells[CURRENT_AUTOREPEAT_SPELL]->m_spellInfo->Id == spell_id))
4280 InterruptSpell(CURRENT_AUTOREPEAT_SPELL, withDelayed, withInstant, bySelf);
4281
4282 // channeled spells are interrupted if they are not finished, even if they are delayed
4283 if (m_currentSpells[CURRENT_CHANNELED_SPELL] && (!spell_id || m_currentSpells[CURRENT_CHANNELED_SPELL]->m_spellInfo->Id == spell_id))
4284 InterruptSpell(CURRENT_CHANNELED_SPELL, true, true, bySelf);
4285}

References CURRENT_AUTOREPEAT_SPELL, CURRENT_CHANNELED_SPELL, CURRENT_GENERIC_SPELL, InterruptSpell(), and m_currentSpells.

Referenced by _EnterVehicle(), PetAI::_stopAttack(), Player::ActivateSpec(), npc_dark_nucleus::npc_dark_nucleusAI::AttackStart(), CleanupBeforeRemoveFromMap(), CombatStop(), boss_julianne::DamageTaken(), boss_onyxia::DamageTaken(), boss_jedoga_shadowseeker::DamageTaken(), boss_algalon_the_observer::DamageTaken(), boss_hodir::DamageTaken(), npc_ulduar_leviathan_mkii::DamageTaken(), npc_ulduar_vx001::DamageTaken(), npc_ulduar_aerial_command_unit::DamageTaken(), npc_ulduar_arachnopod_destroyer::DamageTaken(), boss_ingvar_the_plunderer::DamageTaken(), npc_vrykul_skeleton::DamageTaken(), boss_taerar::boss_taerarAI::DamageTaken(), npc_molten_golem::DamageTaken(), boss_the_lich_king::boss_the_lich_kingAI::DamageTaken(), npc_warden_mellichar::npc_warden_mellicharAI::DamageTaken(), boss_yoggsaron_crusher_tentacle::DamageTaken(), DealDamage(), boss_leotheras_the_blind::DemonTime(), npc_icc_ice_sphere::npc_icc_ice_sphereAI::DoAction(), boss_algalon_the_observer::DoAction(), boss_akilzon::DoAction(), npc_medivh_bm::DoAction(), boss_thorim_sif::DoAction(), boss_nazan::DoAction(), npc_ranshalla::npc_ranshallaAI::DoContinueEscort(), Spell::EffectKnockBack(), boss_leotheras_the_blind::ElfTime(), boss_felblood_kaelthas::GravityLapseSequence(), spell_dk_death_grip::HandleBaseDummy(), WorldSession::HandleCancelCastOpcode(), spell_magtheridon_shadow_grasp::HandleDummyRemove(), spell_novos_crystal_handler_death_aura::HandleEffectApply(), spell_hydross_cleansing_field_command::HandleEffectRemove(), AuraEffect::HandleFeignDeath(), WorldSession::HandleLootOpcode(), WorldSession::HandlePetActionHelper(), spell_the_lich_king_jump::HandleScript(), boss_shade_of_aran::JustEngagedWith(), npc_kilrek::JustEngagedWith(), boss_archimonde::JustEngagedWith(), boss_infinite_corruptor::boss_infinite_corruptorAI::JustEngagedWith(), boss_taldaram::JustEngagedWith(), npc_frostwing_vrykul::npc_frostwing_vrykulAI::JustEngagedWith(), boss_urom::boss_uromAI::JustEngagedWith(), boss_thorim_runic_colossus::JustEngagedWith(), boss_kelidan_the_breaker::JustEngagedWith(), boss_curator::JustEngagedWith(), boss_baltharus_the_warborn::boss_baltharus_the_warbornAI::JustEngagedWith(), boss_novos::JustEngagedWith(), boss_gal_darah::JustEngagedWith(), boss_runemaster_molgeim::JustEngagedWith(), boss_stormcaller_brundir::JustEngagedWith(), violet_hold_trashAI::JustEngagedWith(), PetAI::KilledUnit(), npc_hor_leader_second::npc_hor_leader_secondAI::MoveToNextStopPoint(), boss_shade_of_aran::OnPowerUpdate(), boss_jeklik::PathEndReached(), npc_akama_illidan::PathEndReached(), PretendToDie(), boss_alar::PretendToDie(), SmartScript::ProcessAction(), RemoveAurasWithInterruptFlags(), boss_curator::Reset(), boss_malchezaar::Reset(), boss_varos::boss_varosAI::Reset(), npc_q24545_lich_king::npc_q24545_lich_kingAI::Reset(), boss_talon_king_ikiss::Reset(), boss_high_astromancer_solarian::Reset(), boss_high_botanist_freywinn::ResumeEncounter(), boss_illidan_stormrage::ScheduleAbilities(), boss_the_lurker_below::SchedulerPhaseOne(), npc_putricide_oozeAI::SelectNewTarget(), npc_icc_ice_sphere::npc_icc_ice_sphereAI::SelectNewTarget(), boss_anomalus::SetData(), setDeathState(), npc_cult_fanatic::npc_cult_fanaticAI::SpellHit(), npc_cult_adherent::npc_cult_adherentAI::SpellHit(), boss_razorscale::SpellHit(), boss_flame_leviathan::SpellHit(), StopAttackFaction(), Player::TeleportTo(), CasterAI::UpdateAI(), TotemAI::UpdateAI(), boss_ragnaros::boss_ragnarosAI::UpdateAI(), npc_scholomance_occultist::npc_scholomance_occultistAI::UpdateAI(), boss_paletress::boss_paletressAI::UpdateAI(), npc_hor_lich_king::npc_hor_lich_kingAI::UpdateAI(), boss_ick::boss_ickAI::UpdateAI(), npc_dark_nucleus::npc_dark_nucleusAI::UpdateAI(), boss_the_lich_king::boss_the_lich_kingAI::UpdateAI(), boss_malygos::UpdateAI(), boss_stormcaller_brundir::UpdateAI(), boss_mimiron::UpdateAI(), boss_ymiron::boss_ymironAI::UpdateAI(), npc_lord_arete::npc_lord_areteAI::UpdateAI(), npc_warden_mellichar::npc_warden_mellicharAI::UpdateAI(), npc_pet_hunter_snake_trap::UpdateAI(), npc_pet_mage_mirror_image::UpdateAI(), boss_ichoron::boss_ichoronAI::UpdateAI(), and PetAI::UpdateAI().

◆ InterruptSpell()

void Unit::InterruptSpell ( CurrentSpellTypes  spellType,
bool  withDelayed = true,
bool  withInstant = true,
bool  bySelf = false 
)
4201{
4202 //LOG_DEBUG("entities.unit", "Interrupt spell for unit {}.", GetEntry());
4203 Spell* spell = m_currentSpells[spellType];
4204 if (spell
4205 && (withDelayed || spell->getState() != SPELL_STATE_DELAYED)
4206 && (withInstant || spell->GetCastTime() > 0 || spell->getState() == SPELL_STATE_CASTING)) // xinef: or spell is in casting state (channeled spells only)
4207 {
4208 // for example, do not let self-stun aura interrupt itself
4209 if (!spell->IsInterruptable())
4210 return;
4211
4212 // send autorepeat cancel message for autorepeat spells
4213 if (spellType == CURRENT_AUTOREPEAT_SPELL)
4214 if (IsPlayer())
4216
4217 if (spell->getState() != SPELL_STATE_FINISHED)
4218 spell->cancel(bySelf);
4219 else
4220 {
4221 m_currentSpells[spellType] = nullptr;
4222 spell->SetReferencedFromCurrent(false);
4223 }
4224
4225 if (IsCreature() && IsAIEnabled)
4227 }
4228}
@ SPELL_FINISHED_CANCELED
Definition Spell.h:99
@ SPELL_STATE_DELAYED
Definition Spell.h:239
virtual void OnSpellCastFinished(SpellInfo const *, SpellFinishReason)
Definition CreatureAI.h:151
void SendAutoRepeatCancel(Unit *target)
Definition PlayerMisc.cpp:153
SpellInfo const * GetSpellInfo() const
Definition Spell.h:587
bool IsInterruptable() const
Definition Spell.h:572
int32 GetCastTime() const
Definition Spell.h:558
uint32 getState() const
Definition Spell.h:493
void cancel(bool bySelf=false)
Definition Spell.cpp:3644

References Creature::AI(), Spell::cancel(), CURRENT_AUTOREPEAT_SPELL, Spell::GetCastTime(), Spell::GetSpellInfo(), Spell::getState(), IsAIEnabled, Object::IsCreature(), Spell::IsInterruptable(), Object::IsPlayer(), m_currentSpells, CreatureAI::OnSpellCastFinished(), Player::SendAutoRepeatCancel(), Spell::SetReferencedFromCurrent(), SPELL_FINISHED_CANCELED, SPELL_STATE_CASTING, SPELL_STATE_DELAYED, SPELL_STATE_FINISHED, Object::ToCreature(), and Object::ToPlayer().

Referenced by _UpdateAutoRepeatSpell(), Player::ActivateTaxiPathTo(), Attack(), AttackStop(), CastStop(), Spell::EffectInterruptCast(), Spell::EffectSanctuary(), AuraEffect::HandleAuraModSilence(), WorldSession::HandleCancelAuraOpcode(), WorldSession::HandleCancelAutoRepeatSpellOpcode(), WorldSession::HandleCancelCastOpcode(), WorldSession::HandleCancelChanneling(), spell_hun_scatter_shot::HandleDummy(), AuraEffect::HandleFeignDeath(), InterruptNonMeleeSpells(), SmartAI::JustEngagedWith(), Player::RemoveItemDependentAurasAndCasts(), SetCurrentCastedSpell(), npc_blackhand_incarcerator::npc_blackhand_incarceratorAI::SetData(), boss_nightbane::TriggerHealthTakeOff(), and npc_belnistrasz::npc_belnistraszAI::UpdateAI().

◆ InvalidateValuesUpdateCache()

void Unit::InvalidateValuesUpdateCache ( )
inlineprivate
2207{ _valuesUpdateCache.clear(); }

References _valuesUpdateCache.

Referenced by SetUInt32Value(), and Update().

◆ IsAlive()

bool Unit::IsAlive ( ) const
inline
1777{ return (m_deathState == DeathState::Alive); };

References Alive, and m_deathState.

Referenced by _CreateAuraApplication(), CreatureAI::_EnterEvadeMode(), _EnterVehicle(), _IsValidAssistTarget(), _IsValidAttackTarget(), Player::_LoadItem(), BossAI::_Reset(), WorldBossAI::_Reset(), KillRewarder::_RewardHonor(), KillRewarder::_RewardKillCredit(), KillRewarder::_RewardXP(), PetAI::_stopAttack(), AddAura(), Battleground::AddPlayer(), Map::AddPlayerToMap(), HostileReference::AddThreat(), Spell::AddUnitTarget(), Attack(), PetAI::AttackedBy(), AttackerStateUpdate(), boss_freya::boss_freya(), boss_hodir::boss_hodir(), boss_mimiron::boss_mimiron(), boss_thorim::boss_thorim(), WorldSession::BuildPartyMemberStatsChangedPacket(), Player::BuyItemFromVendorSlot(), CalcAbsorbResist(), CalculateMeleeDamage(), CalculateSpellDamageTaken(), instance_ruins_of_ahnqiraj::instance_ruins_of_ahnqiraj_InstanceMapScript::CallNextRajaxxLeader(), Creature::CanAssistTo(), PetAI::CanAttack(), Player::CanCaptureTowerPoint(), CanHaveThreatList(), Player::CanInteractWithQuestGiver(), Player::CanUseAmmo(), Player::CanUseBattlegroundObject(), Player::CanUseItem(), Player::CastItemCombatSpell(), Player::CheckAreaExploreAndOutdoor(), spell_q12237_rescue_villager::CheckCast(), spell_dk_raise_ally::CheckCast(), spell_hun_check_pet_los::CheckCast(), spell_hun_pet_heart_of_the_phoenix::CheckCast(), spell_hun_bestial_wrath::CheckCast(), Spell::CheckCast(), boss_gothik::boss_gothikAI::CheckGroupSplitted(), BattlegroundRV::CheckPositionForUnit(), spell_mage_focus_magic::CheckProc(), spell_dk_blood_caked_blade::CheckProc(), spell_dk_dancing_rune_weapon::CheckProc(), spell_item_necrotic_touch::CheckProc(), spell_pal_seal_of_righteousness::CheckProc(), spell_warl_siphon_life::CheckProc(), spell_putricide_mutation_init::CheckRequirementInternal(), boss_heigan::CheckSafetyDance(), SpellInfo::CheckTarget(), instance_blackrock_depths::instance_blackrock_depths_InstanceMapScript::CheckTombReset(), CreatureUnitRelocationWorker(), DealDamage(), DealDamageMods(), DealMeleeDamage(), DealSpellDamage(), npc_weegli_blastfuse::npc_weegli_blastfuseAI::DestroyDoor(), Creature::DisappearAndDie(), npc_thrall_warchief::npc_thrall_warchiefAI::DoAction(), npc_xerestrasza::npc_xerestraszaAI::DoAction(), npc_crok_scourgebane::npc_crok_scourgebaneAI::DoAction(), boss_sister_svalna::boss_sister_svalnaAI::DoAction(), boss_high_king_maulgar::DoAction(), npc_pos_martin_or_gorkun_second::npc_pos_martin_or_gorkun_secondAI::DoAction(), boss_infinite_corruptor::boss_infinite_corruptorAI::DoAction(), boss_tharon_ja::boss_tharon_jaAI::DoAction(), boss_thaddius_summon::boss_thaddius_summonAI::DoAction(), boss_xt002::DoAction(), boss_ichoron::boss_ichoronAI::DoAction(), Spell::DoAllEffectOnTarget(), spell_hun_masters_call::DoCheckCast(), RandomMovementGenerator< T >::DoInitialize(), WorldSession::DoLootRelease(), WaypointMovementGenerator< Creature >::DoUpdate(), instance_blackrock_spire::instance_blackrock_spireMapScript::Dragonspireroomcheck(), Spell::EffectAddExtraAttacks(), Spell::EffectEnergize(), Spell::EffectEnergizePct(), Spell::EffectEnvironmentalDMG(), Spell::EffectFeedPet(), Spell::EffectHeal(), Spell::EffectHealMaxHealth(), Spell::EffectHealMechanical(), Spell::EffectHealPct(), Spell::EffectHealthLeech(), Spell::EffectInstaKill(), Spell::EffectInterruptCast(), Spell::EffectPowerBurn(), Spell::EffectPowerDrain(), Spell::EffectResurrect(), Spell::EffectResurrectNew(), Spell::EffectResurrectPet(), Spell::EffectSchoolDMG(), Spell::EffectScriptEffect(), Spell::EffectSelfResurrect(), Spell::EffectSkinPlayerCorpse(), Spell::EffectStuck(), Spell::EffectThreat(), Spell::EffectWeaponDmg(), boss_blood_queen_lana_thel::boss_blood_queen_lana_thelAI::EnterEvadeMode(), npc_tirion_fordring_tft::npc_tirion_fordringAI::EnterEvadeMode(), GuardAI::EnterEvadeMode(), boss_doomrel::boss_doomrelAI::EnterEvadeMode(), npc_pos_freed_slave::npc_pos_freed_slaveAI::EnterEvadeMode(), npc_high_overlord_saurfang_igb::npc_high_overlord_saurfang_igbAI::EnterEvadeMode(), npc_muradin_bronzebeard_igb::npc_muradin_bronzebeard_igbAI::EnterEvadeMode(), gunship_npc_AI::EnterEvadeMode(), npc_gunship_boarding_addAI::EnterEvadeMode(), npc_terenas_menethil::npc_terenas_menethilAI::EnterEvadeMode(), npc_pet_mage_mirror_image::EnterEvadeMode(), Player::EnvironmentalDamage(), Player::EquipItem(), BattleExperienceEvent::Execute(), DelayedMovementEvent::Execute(), IceTombSummonEvent::Execute(), SACActivateEvent::Execute(), boss_sartharion_tenebron::ExecuteEvent(), AssistanceMovementGenerator::Finalize(), Creature::ForcedDespawn(), CreatureGroup::FormationReset(), boss_krik_thir::boss_krik_thirAI::GetData(), npc_highlord_darion_mograine::npc_highlord_darion_mograineAI::GetData(), GetDebugInfo(), Player::GetInitialVisiblePackets(), FollowerAI::GetLeaderForFollower(), Player::getMaxTimer(), CreatureGroup::GetNewTargetForMember(), Player::GetNPCIfCanInteractWith(), GetPartyMembers(), npc_air_force_bots::npc_air_force_botsAI::GetSummonedGuard(), Pet::GivePetXP(), Player::GiveXP(), go_wind_stone::go_wind_stoneAI::GossipSelect(), boss_blood_queen_lana_thel::boss_blood_queen_lana_thelAI::GoToMinchar(), BattlegroundEY::HandleAreaTrigger(), BattlegroundWS::HandleAreaTrigger(), WorldSession::HandleAreaTriggerOpcode(), AuraEffect::HandleAuraDummy(), AuraEffect::HandleAuraModIncreaseHealthPercent(), AuraEffect::HandleAuraModTotalThreat(), WorldSession::HandleAutostoreLootItemOpcode(), WorldSession::HandleBattleFieldPortOpcode(), misc_commandscript::HandleDamageCommand(), misc_commandscript::HandleDieCommand(), Player::HandleDrowning(), spell_dred_raptor_call::HandleDummy(), spell_herald_volzaj_insanity::HandleDummyEffect(), spell_rog_prey_on_the_weak::HandleEffectPeriodic(), WorldSession::HandleEmoteOpcode(), Player::HandleFall(), misc_commandscript::HandleFreezeCommand(), spell_chapter5_return_to_capital::HandleHit(), WorldSession::HandleInitiateTradeOpcode(), WorldSession::HandleLootMoneyOpcode(), WorldSession::HandleMessagechatOpcode(), AuraEffect::HandleModTaunt(), AuraEffect::HandleModTotalPercentStat(), npc_commandscript::HandleNpcMoveCommand(), npc_commandscript::HandleNpcSetMoveTypeCommand(), npc_commandscript::HandleNpcSetWanderDistanceCommand(), AuraEffect::HandleObsModPowerAuraTick(), WorldSession::HandleOpenItemOpcode(), AuraEffect::HandlePeriodicDamageAurasTick(), AuraEffect::HandlePeriodicEnergizeAuraTick(), AuraEffect::HandlePeriodicHealAurasTick(), AuraEffect::HandlePeriodicHealthFunnelAuraTick(), AuraEffect::HandlePeriodicHealthLeechAuraTick(), AuraEffect::HandlePeriodicManaLeechAuraTick(), AuraEffect::HandlePeriodicPowerBurnAuraTick(), WorldSession::HandlePetAction(), WorldSession::HandlePetCancelAuraOpcode(), WorldSession::HandlePetStopAttack(), misc_commandscript::HandlePInfoCommand(), spell_item_mana_drain::HandleProc(), spell_pal_seal_of_command_aura::HandleProc(), spell_gen_black_bow_of_the_betrayer::HandleProc(), WorldSession::HandleReclaimCorpseOpcode(), WorldSession::HandleRepopRequestOpcode(), WorldSession::HandleRequestPartyMemberStatsOpcode(), ArenaSpectator::HandleResetCommand(), WorldSession::HandleSetAmmoOpcode(), WorldSession::HandleSetRaidDifficultyOpcode(), misc_commandscript::HandleSkirmishCommand(), ArenaSpectator::HandleSpectatorSpectateCommand(), ArenaSpectator::HandleSpectatorWatchCommand(), AuraEffect::HandleSpiritOfRedemption(), WorldSession::HandleStablePet(), WorldSession::HandleStableSwapPet(), WorldSession::HandleSummonResponseOpcode(), WorldSession::HandleUnstablePet(), boss_prince_keleseth_icc::boss_prince_kelesethAI::InitializeAI(), boss_prince_taldaram_icc::boss_prince_taldaramAI::InitializeAI(), boss_prince_valanar_icc::boss_prince_valanarAI::InitializeAI(), boss_moroes::InitializeGuests(), Player::IsAtGroupRewardDistance(), Player::IsAtRecruitAFriendDistance(), Creature::IsInvisibleDueToDespawn(), Player::IsOutdoorPvPActive(), Player::IsPetNeedBeTemporaryUnsummoned(), isTargetableForAttack(), IsValidCombatTarget(), Spell::IsValidDeadOrAliveTarget(), ThreatCalcHelper::isValidProcess(), npc_kilrek::JustDied(), boss_rajaxx::JustDied(), boss_twilight_halion::boss_twilight_halionAI::JustDied(), boss_sartharion::JustEngagedWith(), boss_freya::JustEngagedWith(), npc_underbat::JustEngagedWith(), boss_fathomlord_karathress::JustReachedHome(), npc_kiljaeden_controller::JustSummoned(), boss_rotface::boss_rotfaceAI::JustSummoned(), Kill(), boss_anetheron::KilledUnit(), boss_azgalor::KilledUnit(), boss_kazrogal::KilledUnit(), boss_rage_winterchill::KilledUnit(), boss_hadronox::KilledUnit(), boss_gluth::boss_gluthAI::KilledUnit(), CreatureGroup::LeaderMoveTo(), Player::LoadCorpse(), GridObjectLoader::LoadCreatures(), Player::LoadFromDB(), MagicSpellHitResult(), AchievementCriteriaData::Meets(), CreatureGroup::MemberEngagingTarget(), CreatureGroup::MemberEvaded(), npc_twiggy_flathead::npc_twiggy_flatheadAI::MoveInLineOfSight(), boss_lord_marrowgar::MoveInLineOfSight(), npc_icc_valkyr_herald::npc_icc_valkyr_heraldAI::MoveInLineOfSight(), boss_kelthuzad::boss_kelthuzadAI::MoveInLineOfSight(), npc_scion_of_eternity::npc_scion_of_eternity(), instance_blackrock_depths::instance_blackrock_depths_InstanceMapScript::OnCreatureCreate(), instance_karazhan::instance_karazhan_InstanceMapScript::OnCreatureCreate(), instance_sunken_temple::instance_sunken_temple_InstanceMapScript::OnCreatureCreate(), instance_uldaman::instance_uldaman_InstanceMapScript::OnCreatureCreate(), instance_temple_of_ahnqiraj::instance_temple_of_ahnqiraj_InstanceMapScript::OnCreatureCreate(), instance_halls_of_reflection::instance_halls_of_reflection_InstanceMapScript::OnCreatureCreate(), instance_icecrown_citadel::instance_icecrown_citadel_InstanceMapScript::OnCreatureCreate(), instance_shadow_labyrinth::instance_shadow_labyrinth_InstanceMapScript::OnCreatureCreate(), go_palehoof_sphere::OnGossipHello(), go_jotunheim_cage::OnGossipHello(), go_dragonflayer_cage::OnGossipHello(), spell_yogg_saron_brain_link_aura::OnPeriodic(), instance_eye_of_eternity::OnPlayerEnter(), instance_violet_hold::instance_violet_hold_InstanceMapScript::OnPlayerEnter(), at_orb_of_command::OnTrigger(), at_ancient_leaf::OnTrigger(), at_naxxramas_hub_portal::OnTrigger(), AreaTrigger_at_celestial_planetarium_enterance::OnTrigger(), AreaTrigger_at_legion_teleporter::OnTrigger(), AreaTrigger_at_nats_landing::OnTrigger(), AreaTrigger_at_sentry_point::OnTrigger(), SmartTrigger::OnTrigger(), AreaTrigger_at_area_52_entrance::OnTrigger(), at_dragonspire_hall::OnTrigger(), at_blackrock_stadium::OnTrigger(), near_scarshield_infiltrator::OnTrigger(), at_scarshield_infiltrator::OnTrigger(), at_commander_dawnforge::OnTrigger(), RisenArchmageCheck::operator()(), WretchedGhoulCleaner::operator()(), ValithriaDespawner::operator()(), Acore::AnyDeadUnitObjectInRangeCheck::operator()(), Acore::NearestCreatureEntryWithLiveStateInObjectRangeCheck::operator()(), Acore::PlayerAtMinimumRangeAway::operator()(), Acore::AnyDeadUnitObjectInRangeCheck::operator()(), Acore::AnyPlayerInObjectRangeCheck::operator()(), Acore::NearestPlayerInObjectRangeCheck::operator()(), Acore::MostHPMissingInRange::operator()(), Acore::MostHPPercentMissingInRange::operator()(), Acore::FriendlyCCedInRange::operator()(), Acore::FriendlyMissingBuffInRange::operator()(), Acore::AnyUnfriendlyUnitInObjectRangeCheck::operator()(), Acore::AnyUnfriendlyNoTotemUnitInObjectRangeCheck::operator()(), Acore::NearestAttackableNoTotemUnitInObjectRangeCheck::operator()(), Acore::AnyFriendlyUnitInObjectRangeCheck::operator()(), Acore::AnyFriendlyNotSelfUnitInObjectRangeCheck::operator()(), Acore::AnyGroupedUnitInObjectRangeCheck::operator()(), Acore::AnyUnitInObjectRangeCheck::operator()(), Acore::AnyAttackableUnitExceptForOriginalCasterInObjectRangeCheck::operator()(), Acore::AnyDeadUnitCheck::operator()(), Acore::AllFriendlyCreaturesInGrid::operator()(), Acore::MostHPMissingGroupInRange::operator()(), FrostwingVrykulSearcher::operator()(), Acore::AllDeadCreaturesInRange::operator()(), ShadowTrapLKTargetSelector::operator()(), NonTankLKTargetSelector::operator()(), DefileTargetSelector::operator()(), Acore::AnyUnfriendlyAttackableVisibleUnitInObjectRangeCheck::operator()(), PetAI::OwnerAttacked(), npc_pet_gen_valkyr_guardian::OwnerAttacked(), PetAI::OwnerAttackedBy(), npc_eoe_wyrmrest_skytalon::PassengerBoarded(), boss_kologarn::PassengerBoarded(), MapMgr::PlayerCannotEnter(), SmartScript::ProcessAction(), ProcSkillsAndAuras(), RemoveCharmedBy(), Group::RemoveMember(), Battleground::RemovePlayerAtLeave(), Player::RepopAtGraveyard(), boss_kiljaeden::Reset(), boss_blood_queen_lana_thel::boss_blood_queen_lana_thelAI::Reset(), boss_fathomlord_karathress::Reset(), instance_blood_furnace::instance_blood_furnace_InstanceMapScript::ResetPrisoner(), Creature::Respawn(), Player::RewardPlayerAndGroupAtEvent(), BossAI::ScheduleEnrageTimer(), boss_gluth::boss_gluthAI::SelectPlayerInRoom(), Player::SendLoot(), npc_corrupted_totem::SetAura(), instance_naxxramas::SetBossState(), SetConfused(), boss_emperor_dagran_thaurissan::boss_draganthaurissanAI::SetData(), instance_scarlet_monastery::instance_scarlet_monastery_InstanceMapScript::SetData(), npc_enslaved_proto_drake::SetData(), npc_pos_tyrannus_events::npc_pos_tyrannus_eventsAI::SetData(), boss_teron_gorefiend::SetData(), Player::setDeathState(), SetFeared(), SetHover(), SetInCombatState(), SetStunned(), Battlefield::ShowNpc(), npc_dark_iron_guzzler::SpellHit(), npc_injured_patient::npc_injured_patientAI::SpellHit(), npc_hor_lich_king::npc_hor_lich_kingAI::SpellHitTarget(), npc_oculus_drake::npc_oculus_drakeAI::SpellHitTarget(), WaypointMovementGenerator< Creature >::StartMove(), PassengerController::SummonCreatures(), boss_rend_blackhand::boss_rend_blackhandAI::SummonedCreatureDespawn(), boss_priestess_delrissa::SummonedCreatureDies(), Player::SwapItem(), lfg::LFGMgr::TeleportPlayer(), BattlegroundRV::TeleportUnitToNewZ(), Pet::Update(), instance_stratholme::instance_stratholme_InstanceMapScript::Update(), Creature::Update(), TempSummon::Update(), Puppet::Update(), Player::Update(), Totem::Update(), Update(), TimedFleeingMovementGenerator::Update(), TotemAI::UpdateAI(), go_blood_drenched_door::go_blood_drenched_doorAI::UpdateAI(), npc_a_special_surprise::npc_a_special_surpriseAI::UpdateAI(), npc_dark_iron_guzzler::UpdateAI(), npc_twiggy_flathead::npc_twiggy_flatheadAI::UpdateAI(), boss_gormok::boss_gormokAI::UpdateAI(), npc_pos_leader::npc_pos_leaderAI::UpdateAI(), npc_bone_spike::npc_bone_spikeAI::UpdateAI(), npc_ice_tomb::npc_ice_tombAI::UpdateAI(), boss_malygos::UpdateAI(), boss_sjonnir_malformed_ooze::boss_sjonnir_malformed_oozeAI::UpdateAI(), boss_runemaster_molgeim::UpdateAI(), boss_vezax::UpdateAI(), boss_ignis::UpdateAI(), npc_ulduar_arachnopod_destroyer::UpdateAI(), npc_vrykul_skeleton::UpdateAI(), boss_erekem::boss_erekemAI::UpdateAI(), npc_pet_mage_mirror_image::UpdateAI(), npc_injured_patient::npc_injured_patientAI::UpdateAI(), PetAI::UpdateAI(), npc_gunship::npc_gunshipAI::UpdateAI(), npc_tooga::npc_toogaAI::UpdateFollowerAI(), npc_ringo::npc_ringoAI::UpdateFollowerAI(), InstanceScript::UpdateMinionState(), Creature::UpdateMovementFlags(), boss_netherspite::UpdatePortals(), boss_twin_valkyrAI::UpdateSharedHealth(), UpdateSplineMovement(), Player::UpdateZone(), and npc_ancestral_wolf::npc_ancestral_wolfAI::WaypointReached().

◆ IsAlwaysDetectableFor()

bool Unit::IsAlwaysDetectableFor ( WorldObject const *  seer) const
overrideprotectedvirtual

Reimplemented from WorldObject.

11154{
11156 return true;
11157
11158 if (HasAuraTypeWithCaster(SPELL_AURA_MOD_STALKED, seer->GetGUID()))
11159 return true;
11160
11161 if (Player* ownerPlayer = GetSpellModOwner())
11162 if (Player const* seerPlayer = seer->ToPlayer())
11163 {
11164 if (ownerPlayer->IsGroupVisibleFor(seerPlayer))
11165 return true;
11166 }
11167
11168 return false;
11169}
@ SPELL_AURA_MOD_STALKED
Definition SpellAuraDefines.h:131
virtual bool IsAlwaysDetectableFor(WorldObject const *) const
Definition Object.h:760

References Object::GetGUID(), GetSpellModOwner(), HasAuraTypeWithCaster(), WorldObject::IsAlwaysDetectableFor(), SPELL_AURA_MOD_STALKED, and Object::ToPlayer().

Referenced by Creature::IsAlwaysDetectableFor(), and Player::IsAlwaysDetectableFor().

◆ IsAlwaysVisibleFor()

bool Unit::IsAlwaysVisibleFor ( WorldObject const *  seer) const
overrideprotectedvirtual

: Check if unit is eligible for sparring damages. Work only if attacker and victim are creatures.

Reimplemented from WorldObject.

11135{
11137 return true;
11138
11139 // Always seen by owner
11140 if (ObjectGuid guid = GetCharmerOrOwnerGUID())
11141 if (seer->GetGUID() == guid)
11142 return true;
11143
11144 if (Player const* seerPlayer = seer->ToPlayer())
11145 if (Unit* owner = GetOwner())
11146 if (Player* ownerPlayer = owner->ToPlayer())
11147 if (ownerPlayer->IsGroupVisibleFor(seerPlayer))
11148 return true;
11149
11150 return false;
11151}
virtual bool IsAlwaysVisibleFor(WorldObject const *) const
Definition Object.h:757

References GetCharmerOrOwnerGUID(), Object::GetGUID(), GetOwner(), WorldObject::IsAlwaysVisibleFor(), and Object::ToPlayer().

◆ IsArmorer()

bool Unit::IsArmorer ( ) const
inline
@ UNIT_NPC_FLAG_REPAIR
Definition UnitDefines.h:331
bool HasNpcFlag(NPCFlags flags) const
Definition Unit.h:757

References HasNpcFlag(), and UNIT_NPC_FLAG_REPAIR.

◆ isAttackingPlayer()

bool Unit::isAttackingPlayer ( ) const
7452{
7454 return true;
7455
7456 if (!m_Controlled.empty())
7457 for (ControlSet::const_iterator itr = m_Controlled.begin(); itr != m_Controlled.end(); ++itr)
7458 if ((*itr)->isAttackingPlayer())
7459 return true;
7460
7461 for (uint8 i = 0; i < MAX_SUMMON_SLOT; ++i)
7462 if (m_SummonSlot[i])
7463 if (Creature* summon = GetMap()->GetCreature(m_SummonSlot[i]))
7464 if (summon->isAttackingPlayer())
7465 return true;
7466
7467 return false;
7468}
Creature * GetCreature(ObjectGuid const &guid)
Definition Map.cpp:2357

References Map::GetCreature(), WorldObject::GetMap(), HasUnitState(), m_Controlled, m_SummonSlot, MAX_SUMMON_SLOT, and UNIT_STATE_ATTACK_PLAYER.

◆ isAttackReady()

◆ IsAttackSpeedOverridenShapeShift()

bool Unit::IsAttackSpeedOverridenShapeShift ( ) const
15612{
15613 // Mirroring clientside gameplay logic
15614 if (ShapeshiftForm form = GetShapeshiftForm())
15615 if (SpellShapeshiftFormEntry const* entry = sSpellShapeshiftFormStore.LookupEntry(form))
15616 return entry->attackSpeed > 0;
15617
15618 return false;
15619}

References GetShapeshiftForm(), and sSpellShapeshiftFormStore.

Referenced by Player::CalculateMinMaxDamage().

◆ IsAuctioner()

bool Unit::IsAuctioner ( ) const
inline
@ UNIT_NPC_FLAG_AUCTIONEER
Definition UnitDefines.h:340

References HasNpcFlag(), and UNIT_NPC_FLAG_AUCTIONEER.

◆ IsBanker()

bool Unit::IsBanker ( ) const
inline
@ UNIT_NPC_FLAG_BANKER
Definition UnitDefines.h:336

References HasNpcFlag(), and UNIT_NPC_FLAG_BANKER.

◆ IsBattleMaster()

bool Unit::IsBattleMaster ( ) const
inline

◆ isBeingLoaded()

virtual bool Unit::isBeingLoaded ( ) const
inlinevirtual

Reimplemented in Pet, and Player.

696{ return false;}

Referenced by Player::SetMover().

◆ isBlockCritical()

bool Unit::isBlockCritical ( )
3257{
3259 return true;
3260 return false;
3261}
@ SPELL_AURA_MOD_BLOCK_CRIT_CHANCE
Definition SpellAuraDefines.h:316

References GetTotalAuraModifier(), roll_chance_i(), and SPELL_AURA_MOD_BLOCK_CRIT_CHANCE.

Referenced by CalculateMeleeDamage(), and CalculateSpellDamageTaken().

◆ IsCharmed()

◆ IsCharmedOwnedByPlayerOrPlayer()

bool Unit::IsCharmedOwnedByPlayerOrPlayer ( ) const
inline

◆ IsClass()

◆ IsClientControlled()

bool Unit::IsClientControlled ( Player const *  exactClient = nullptr) const
17559{
17560 // Severvide method to check if unit is client controlled (optionally check for specific client in control)
17561
17562 // Applies only to player controlled units
17564 return false;
17565
17566 // These flags are meant to be used when server controls this unit, client control is taken away
17568 return false;
17569
17570 // If unit is possessed, it has lost original control...
17571 if (ObjectGuid const& guid = GetCharmerGUID())
17572 {
17573 // ... but if it is a possessing charm, then we have to check if some other player controls it
17574 if (HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_POSSESSED) && guid.IsPlayer())
17575 return (exactClient ? (exactClient->GetGUID() == guid) : true);
17576 return false;
17577 }
17578
17579 // By default: players have client control over themselves
17580 if (IsPlayer())
17581 return (exactClient ? (exactClient == this) : true);
17582 return false;
17583}
@ UNIT_FLAG_CONFUSED
Definition UnitDefines.h:276
@ UNIT_FLAG_DISABLE_MOVE
Definition UnitDefines.h:256
@ UNIT_FLAG_FLEEING
Definition UnitDefines.h:277

References GetCharmerGUID(), Object::GetGUID(), Object::HasFlag(), Object::IsPlayer(), UNIT_FIELD_FLAGS, UNIT_FLAG_CONFUSED, UNIT_FLAG_DISABLE_MOVE, UNIT_FLAG_FLEEING, UNIT_FLAG_PLAYER_CONTROLLED, and UNIT_FLAG_POSSESSED.

Referenced by GetClientControlling(), SetCanFly(), SetDisableGravity(), SetFeatherFall(), SetHover(), SetSpeed(), and SetWaterWalking().

◆ IsContestedGuard()

bool Unit::IsContestedGuard ( ) const
inline
1019 {
1020 if (FactionTemplateEntry const* entry = GetFactionTemplateEntry())
1021 return entry->IsContestedGuardFaction();
1022
1023 return false;
1024 }

References GetFactionTemplateEntry().

Referenced by Acore::NearestVisibleDetectableContestedGuardUnitCheck::operator()().

◆ IsControllableGuardian()

bool Unit::IsControllableGuardian ( ) const
inline

◆ IsControlledByPlayer()

◆ IsCreatedByPlayer()

bool Unit::IsCreatedByPlayer ( ) const
inline
1297{ return m_CreatedByPlayer; }

References m_CreatedByPlayer.

Referenced by DealDamage().

◆ IsCritter()

◆ IsCrowdControlled()

◆ IsDamageReducedByArmor()

bool Unit::IsDamageReducedByArmor ( SpellSchoolMask  damageSchoolMask,
SpellInfo const *  spellInfo = nullptr,
uint8  effIndex = MAX_SPELL_EFFECTS 
)
static
2133{
2134 // only physical spells damage gets reduced by armor
2135 if ((schoolMask & SPELL_SCHOOL_MASK_NORMAL) == 0)
2136 return false;
2137 if (spellInfo)
2138 {
2139 // there are spells with no specific attribute but they have "ignores armor" in tooltip
2140 if (spellInfo->HasAttribute(SPELL_ATTR0_CU_IGNORE_ARMOR))
2141 return false;
2142
2143 // bleeding effects are not reduced by armor
2144 if (effIndex != MAX_SPELL_EFFECTS)
2145 {
2146 if (spellInfo->Effects[effIndex].ApplyAuraName == SPELL_AURA_PERIODIC_DAMAGE ||
2147 spellInfo->Effects[effIndex].Effect == SPELL_EFFECT_SCHOOL_DAMAGE)
2148 if (spellInfo->GetEffectMechanicMask(effIndex) & (1 << MECHANIC_BLEED))
2149 return false;
2150 }
2151 }
2152 return true;
2153}
@ MECHANIC_BLEED
Definition SharedDefines.h:1351
@ SPELL_ATTR0_CU_IGNORE_ARMOR
Definition SpellInfo.h:191

References SpellInfo::Effects, SpellInfo::GetEffectMechanicMask(), SpellInfo::HasAttribute(), MAX_SPELL_EFFECTS, MECHANIC_BLEED, SPELL_ATTR0_CU_IGNORE_ARMOR, SPELL_AURA_PERIODIC_DAMAGE, SPELL_EFFECT_SCHOOL_DAMAGE, and SPELL_SCHOOL_MASK_NORMAL.

Referenced by CalculateMeleeDamage(), CalculateSpellDamageTaken(), AuraEffect::HandlePeriodicDamageAurasTick(), and AuraEffect::HandlePeriodicHealthLeechAuraTick().

◆ isDead()

bool Unit::isDead ( ) const
inline

References Corpse, Dead, and m_deathState.

Referenced by npc_lord_illidan_stormrage::npc_lord_illidan_stormrageAI::CheckEventFail(), boss_sindragosa::boss_sindragosaAI::DoAction(), npc_spinestalker::npc_spinestalkerAI::DoAction(), npc_rimefang::npc_rimefangAI::DoAction(), Spell::EffectSummonPet(), Player::GiveLevel(), AuraEffect::HandleAuraDummy(), Player::HandleFall(), boss_malygos::HandleIntroSpeech(), misc_commandscript::HandleRespawnCommand(), spell_prince_taldaram_conjure_flame_sphere::HandleScript(), Creature::HasSpellFocus(), UnitAI::InitializeAI(), SmartAI::InitializeAI(), npc_troll_volunteer::npc_troll_volunteerAI::InitializeAI(), npc_spinestalker::npc_spinestalkerAI::InitializeAI(), npc_rimefang::npc_rimefangAI::InitializeAI(), npc_sindragosa_trash::npc_sindragosa_trashAI::InitializeAI(), npc_ulduar_mimiron_rocket::InitializeAI(), npc_bushwhacker::npc_bushwhackerAI::InitializeAI(), Player::isAllowedToLoot(), npc_anubisath_sentinel::aqsentinelAI::JustDied(), Player::OnGossipSelect(), AreaTrigger_at_stormwright_shelf::OnTrigger(), AreaTrigger_at_scent_larkorwi::OnTrigger(), at_bring_your_orphan_to::OnTrigger(), Player::PrepareGossipMenu(), SmartScript::ProcessAction(), Player::RepopAtGraveyard(), npc_anubisath_sentinel::aqsentinelAI::Reset(), WorldSession::SendAttackStop(), SendMeleeAttackStop(), instance_molten_core::instance_molten_core_InstanceMapScript::SetBossState(), and npc_snobold_vassal::npc_snobold_vassalAI::UpdateAI().

◆ IsDuringRemoveFromWorld()

◆ isDying()

bool Unit::isDying ( ) const
inline
1778{ return (m_deathState == DeathState::JustDied); };

References JustDied, and m_deathState.

Referenced by Creature::IsInvisibleDueToDespawn().

◆ IsEngaged()

◆ IsEngagedBy()

bool Unit::IsEngagedBy ( Unit const *  who) const
inline

◆ IsFalling()

◆ IsFFAPvP()

bool Unit::IsFFAPvP ( ) const
inline

◆ IsFlying()

◆ IsFriendlyTo()

bool Unit::IsFriendlyTo ( Unit const *  unit) const
7206{
7207 return GetReactionTo(unit) >= REP_FRIENDLY;
7208}

References GetReactionTo(), and REP_FRIENDLY.

Referenced by Spell::_cast(), AuraApplication::_InitFlags(), Creature::_IsTargetAcceptable(), FollowerAI::AssistPlayerInCombatAgainst(), npc_tapoke_slim_jahn::npc_tapoke_slim_jahnAI::AttackedBy(), Creature::CanAssistTo(), spell_dk_death_coil::CheckCast(), spell_pal_holy_shock::CheckCast(), spell_pri_penance::CheckCast(), Spell::CheckCast(), spell_pri_glyph_of_dispel_magic::CheckProc(), Spell::DoAllEffectOnTarget(), Spell::DoSpellHitOnUnit(), Spell::EffectDispel(), Spell::EffectDispelMechanic(), Spell::EffectStealBeneficialBuff(), Spell::EffectThreat(), Aura::HandleAuraSpecificMods(), spell_dk_death_coil::HandleDummy(), spell_pal_holy_shock::HandleDummy(), spell_pri_penance::HandleDummy(), BattlefieldWG::HandleKill(), spell_winter_veil_shoot_air_rifle::HandleScriptEffect(), WorldSession::HandleSetSelectionOpcode(), Spell::HandleThreatSpells(), GameObject::IsAlwaysVisibleFor(), SpellClickInfo::IsFitToRequirements(), npc_draenei_survivor::npc_draenei_survivorAI::MoveInLineOfSight(), Acore::AnyUnfriendlyUnitInObjectRangeCheck::operator()(), Acore::AnyUnfriendlyNoTotemUnitInObjectRangeCheck::operator()(), Acore::AnyFriendlyUnitInObjectRangeCheck::operator()(), Acore::AnyFriendlyNotSelfUnitInObjectRangeCheck::operator()(), Acore::AllFriendlyCreaturesInGrid::operator()(), Acore::AnyUnfriendlyAttackableVisibleUnitInObjectRangeCheck::operator()(), Acore::WorldObjectSpellTargetCheck::operator()(), PetSpellFail(), SmartScript::ProcessEvent(), RemoveCharmedBy(), Spell::SelectExplicitTargets(), Player::SendLoot(), Acore::MessageDistDelivererToHostile::SendPacket(), and TotemAI::UpdateAI().

◆ isFrozen()

◆ IsFullHealth()

◆ IsGossip()

bool Unit::IsGossip ( ) const
inline
@ UNIT_NPC_FLAG_GOSSIP
Definition UnitDefines.h:319

References HasNpcFlag(), and UNIT_NPC_FLAG_GOSSIP.

◆ IsGuardian()

◆ IsGuildMaster()

bool Unit::IsGuildMaster ( ) const
inline
@ UNIT_NPC_FLAG_PETITIONER
Definition UnitDefines.h:337

References HasNpcFlag(), and UNIT_NPC_FLAG_PETITIONER.

◆ IsHighestExclusiveAura()

bool Unit::IsHighestExclusiveAura ( Aura const *  aura,
bool  removeOtherAuraApplications = false 
)
4531{
4532 for (uint32 i = 0 ; i < MAX_SPELL_EFFECTS; ++i)
4533 if (AuraEffect const* aurEff = aura->GetEffect(i))
4534 if (!IsHighestExclusiveAuraEffect(aura->GetSpellInfo(), aurEff->GetAuraType(), aurEff->GetAmount(), aura->GetEffectMask(), removeOtherAuraApplications))
4535 return false;
4536
4537 return true;
4538}
bool IsHighestExclusiveAuraEffect(SpellInfo const *spellInfo, AuraType auraType, int32 effectAmount, uint8 auraEffectMask, bool removeOtherAuraApplications=false)
Definition Unit.cpp:4540

References Aura::GetEffect(), Aura::GetEffectMask(), Aura::GetSpellInfo(), IsHighestExclusiveAuraEffect(), and MAX_SPELL_EFFECTS.

Referenced by _RemoveNoStackAurasDueToAura().

◆ IsHighestExclusiveAuraEffect()

bool Unit::IsHighestExclusiveAuraEffect ( SpellInfo const *  spellInfo,
AuraType  auraType,
int32  effectAmount,
uint8  auraEffectMask,
bool  removeOtherAuraApplications = false 
)
4541{
4542 AuraEffectList const& auras = GetAuraEffectsByType(auraType);
4543 for (Unit::AuraEffectList::const_iterator itr = auras.begin(); itr != auras.end();)
4544 {
4545 AuraEffect const* existingAurEff = (*itr);
4546 ++itr;
4547
4548 if (sSpellMgr->CheckSpellGroupStackRules(spellInfo, existingAurEff->GetSpellInfo()) == SPELL_GROUP_STACK_RULE_EXCLUSIVE_HIGHEST)
4549 {
4550 int32 diff = abs(effectAmount) - abs(existingAurEff->GetAmount());
4551 if (!diff)
4552 for (int32 i = 0; i < MAX_SPELL_EFFECTS; ++i)
4553 diff += int32((auraEffectMask & (1 << i)) >> i) - int32((existingAurEff->GetBase()->GetEffectMask() & (1 << i)) >> i);
4554
4555 if (diff > 0)
4556 {
4557 Aura const* base = existingAurEff->GetBase();
4558 // no removing of area auras from the original owner, as that completely cancels them
4559 if (removeOtherAuraApplications && (!base->IsArea() || base->GetOwner() != this))
4560 {
4561 if (AuraApplication* aurApp = existingAurEff->GetBase()->GetApplicationOfTarget(GetGUID()))
4562 {
4563 bool hasMoreThanOneEffect = base->HasMoreThanOneEffectForType(auraType);
4564 uint32 removedAuras = m_removedAurasCount;
4565 RemoveAura(aurApp);
4566 if (hasMoreThanOneEffect || m_removedAurasCount > removedAuras)
4567 itr = auras.begin();
4568 }
4569 }
4570 }
4571 else if (diff < 0)
4572 return false;
4573 }
4574 }
4575
4576 return true;
4577}
@ SPELL_GROUP_STACK_RULE_EXCLUSIVE_HIGHEST
Definition SpellMgr.h:363
bool HasMoreThanOneEffectForType(AuraType auraType) const
Definition SpellAuras.cpp:1008
bool IsArea() const
Definition SpellAuras.cpp:1018

References AuraEffect::GetAmount(), Aura::GetApplicationOfTarget(), GetAuraEffectsByType(), AuraEffect::GetBase(), Aura::GetEffectMask(), Object::GetGUID(), Aura::GetOwner(), AuraEffect::GetSpellInfo(), Aura::HasMoreThanOneEffectForType(), Aura::IsArea(), m_removedAurasCount, MAX_SPELL_EFFECTS, RemoveAura(), SPELL_GROUP_STACK_RULE_EXCLUSIVE_HIGHEST, and sSpellMgr.

Referenced by IsHighestExclusiveAura().

◆ IsHostileTo()

◆ IsHostileToPlayers()

bool Unit::IsHostileToPlayers ( ) const
7211{
7212 FactionTemplateEntry const* my_faction = GetFactionTemplateEntry();
7213 if (!my_faction || !my_faction->faction)
7214 return false;
7215
7216 FactionEntry const* raw_faction = sFactionStore.LookupEntry(my_faction->faction);
7217 if (raw_faction && raw_faction->reputationListID >= 0)
7218 return false;
7219
7220 return my_faction->IsHostileToPlayers();
7221}
int32 reputationListID
Definition DBCStructure.h:909
uint32 faction
Definition DBCStructure.h:941
bool IsHostileToPlayers() const
Definition DBCStructure.h:981

References FactionTemplateEntry::faction, GetFactionTemplateEntry(), FactionTemplateEntry::IsHostileToPlayers(), FactionEntry::reputationListID, and sFactionStore.

◆ IsHovering()

bool Unit::IsHovering ( ) const
inline

◆ IsHunterPet()

◆ IsImmobilizedState()

◆ IsImmunedToDamage() [1/3]

bool Unit::IsImmunedToDamage ( Spell const *  spell) const
9737{
9738 SpellInfo const* spellInfo = spell->GetSpellInfo();
9739 if (!spellInfo)
9740 {
9741 return false;
9742 }
9743
9745 {
9746 return false;
9747 }
9748
9750 {
9751 return false;
9752 }
9753
9754 uint32 schoolMask = spell->GetSpellSchoolMask();
9755 if (schoolMask == SPELL_SCHOOL_MASK_NONE)
9756 {
9757 return false;
9758 }
9759
9760 // If m_immuneToDamage type contain magic, IMMUNE damage.
9761 SpellImmuneList const& damageList = m_spellImmune[IMMUNITY_DAMAGE];
9762 for (SpellImmuneList::const_iterator itr = damageList.begin(); itr != damageList.end(); ++itr)
9763 {
9764 if ((itr->type & schoolMask) == schoolMask)
9765 {
9766 return true;
9767 }
9768 }
9769
9770 return false;
9771}
@ SPELL_ATTR2_NO_SCHOOL_IMMUNITIES
Definition SharedDefines.h:493
@ SPELL_ATTR1_IMMUNITY_TO_HOSTILE_AND_FRIENDLY_EFFECTS
Definition SharedDefines.h:446
@ IMMUNITY_DAMAGE
Definition SharedDefines.h:1408
@ SPELL_SCHOOL_MASK_NONE
Definition SharedDefines.h:307
std::vector< SpellImmune > SpellImmuneList
Definition SpellDefines.h:182

References Spell::GetSpellInfo(), Spell::GetSpellSchoolMask(), SpellInfo::HasAttribute(), HasSpiritOfRedemptionAura(), IMMUNITY_DAMAGE, m_spellImmune, SPELL_ATTR0_NO_IMMUNITIES, SPELL_ATTR1_IMMUNITY_TO_HOSTILE_AND_FRIENDLY_EFFECTS, SPELL_ATTR2_NO_SCHOOL_IMMUNITIES, and SPELL_SCHOOL_MASK_NONE.

◆ IsImmunedToDamage() [2/3]

bool Unit::IsImmunedToDamage ( SpellInfo const *  spellInfo) const
9705{
9706 if (!spellInfo)
9707 {
9708 return false;
9709 }
9710
9711 if (spellInfo->HasAttribute(SPELL_ATTR0_NO_IMMUNITIES) && !HasSpiritOfRedemptionAura())
9712 {
9713 return false;
9714 }
9715
9716 if (spellInfo->HasAttribute(SPELL_ATTR1_IMMUNITY_TO_HOSTILE_AND_FRIENDLY_EFFECTS) || spellInfo->HasAttribute(SPELL_ATTR2_NO_SCHOOL_IMMUNITIES))
9717 {
9718 return false;
9719 }
9720
9721 uint32 schoolMask = spellInfo->GetSchoolMask();
9722 if (schoolMask == SPELL_SCHOOL_MASK_NONE)
9723 {
9724 return false;
9725 }
9726
9727 // If m_immuneToDamage type contain magic, IMMUNE damage.
9728 SpellImmuneList const& damageList = m_spellImmune[IMMUNITY_DAMAGE];
9729 for (SpellImmuneList::const_iterator itr = damageList.begin(); itr != damageList.end(); ++itr)
9730 if ((itr->type & schoolMask) == schoolMask)
9731 return true;
9732
9733 return false;
9734}

References SpellInfo::GetSchoolMask(), SpellInfo::HasAttribute(), HasSpiritOfRedemptionAura(), IMMUNITY_DAMAGE, m_spellImmune, SPELL_ATTR0_NO_IMMUNITIES, SPELL_ATTR1_IMMUNITY_TO_HOSTILE_AND_FRIENDLY_EFFECTS, SPELL_ATTR2_NO_SCHOOL_IMMUNITIES, and SPELL_SCHOOL_MASK_NONE.

◆ IsImmunedToDamage() [3/3]

bool Unit::IsImmunedToDamage ( SpellSchoolMask  meleeSchoolMask) const
9689{
9690 if (meleeSchoolMask == SPELL_SCHOOL_MASK_NONE)
9691 {
9692 return false;
9693 }
9694
9695 // If m_immuneToDamage type contain magic, IMMUNE damage.
9696 SpellImmuneList const& damageList = m_spellImmune[IMMUNITY_DAMAGE];
9697 for (SpellImmuneList::const_iterator itr = damageList.begin(); itr != damageList.end(); ++itr)
9698 if ((itr->type & meleeSchoolMask) == meleeSchoolMask)
9699 return true;
9700
9701 return false;
9702}

References IMMUNITY_DAMAGE, m_spellImmune, and SPELL_SCHOOL_MASK_NONE.

Referenced by boss_gurtogg_bloodboil::CanAIAttack(), Spell::DoSpellHitOnUnit(), IsImmunedToDamageOrSchool(), and IsImmunedToDamageOrSchool().

◆ IsImmunedToDamageOrSchool() [1/2]

bool Unit::IsImmunedToDamageOrSchool ( SpellInfo const *  spellInfo) const
9853{
9854 return IsImmunedToDamage(spellInfo) || IsImmunedToSchool(spellInfo);
9855}
bool IsImmunedToSchool(SpellSchoolMask meleeSchoolMask) const
Definition Unit.cpp:9773
bool IsImmunedToDamage(SpellSchoolMask meleeSchoolMask) const
Definition Unit.cpp:9688

References IsImmunedToDamage(), and IsImmunedToSchool().

◆ IsImmunedToDamageOrSchool() [2/2]

◆ IsImmunedToSchool() [1/3]

bool Unit::IsImmunedToSchool ( Spell const *  spell) const
9813{
9814 SpellInfo const* spellInfo = spell->GetSpellInfo();
9816 {
9817 return false;
9818 }
9819
9820 uint32 schoolMask = spell->GetSpellSchoolMask();
9821 if (schoolMask == SPELL_SCHOOL_MASK_NONE)
9822 {
9823 return false;
9824 }
9825
9826 if (spellInfo->Id != 42292 && spellInfo->Id != 59752 && spellInfo->Id != 19574 && spellInfo->Id != 34471)
9827 {
9828 // If m_immuneToSchool type contain this school type, IMMUNE damage.
9829 SpellImmuneList const& schoolList = m_spellImmune[IMMUNITY_SCHOOL];
9830 for (SpellImmuneList::const_iterator itr = schoolList.begin(); itr != schoolList.end(); ++itr)
9831 {
9832 if ((itr->type & schoolMask) == schoolMask && !spellInfo->CanPierceImmuneAura(sSpellMgr->GetSpellInfo(itr->spellId)))
9833 {
9834 return true;
9835 }
9836 }
9837 }
9838
9839 return false;
9840}
@ IMMUNITY_SCHOOL
Definition SharedDefines.h:1407
bool CanPierceImmuneAura(SpellInfo const *aura) const
Definition SpellInfo.cpp:1322

References SpellInfo::CanPierceImmuneAura(), Spell::GetSpellInfo(), Spell::GetSpellSchoolMask(), SpellInfo::HasAttribute(), HasSpiritOfRedemptionAura(), SpellInfo::Id, IMMUNITY_SCHOOL, m_spellImmune, SPELL_ATTR0_NO_IMMUNITIES, SPELL_SCHOOL_MASK_NONE, and sSpellMgr.

◆ IsImmunedToSchool() [2/3]

bool Unit::IsImmunedToSchool ( SpellInfo const *  spellInfo) const
9790{
9791 if (spellInfo->HasAttribute(SPELL_ATTR0_NO_IMMUNITIES) && !HasSpiritOfRedemptionAura())
9792 return false;
9793
9794 uint32 schoolMask = spellInfo->GetSchoolMask();
9795 if (schoolMask == SPELL_SCHOOL_MASK_NONE)
9796 {
9797 return false;
9798 }
9799
9800 if (spellInfo->Id != 42292 && spellInfo->Id != 59752 && spellInfo->Id != 19574 && spellInfo->Id != 34471)
9801 {
9802 // If m_immuneToSchool type contain this school type, IMMUNE damage.
9803 SpellImmuneList const& schoolList = m_spellImmune[IMMUNITY_SCHOOL];
9804 for (SpellImmuneList::const_iterator itr = schoolList.begin(); itr != schoolList.end(); ++itr)
9805 if ((itr->type & schoolMask) == schoolMask && !spellInfo->CanPierceImmuneAura(sSpellMgr->GetSpellInfo(itr->spellId)))
9806 return true;
9807 }
9808
9809 return false;
9810}

References SpellInfo::CanPierceImmuneAura(), SpellInfo::GetSchoolMask(), SpellInfo::HasAttribute(), HasSpiritOfRedemptionAura(), SpellInfo::Id, IMMUNITY_SCHOOL, m_spellImmune, SPELL_ATTR0_NO_IMMUNITIES, SPELL_SCHOOL_MASK_NONE, and sSpellMgr.

◆ IsImmunedToSchool() [3/3]

bool Unit::IsImmunedToSchool ( SpellSchoolMask  meleeSchoolMask) const
9774{
9775 if (meleeSchoolMask == SPELL_SCHOOL_MASK_NONE)
9776 {
9777 return false;
9778 }
9779
9780 // If m_immuneToSchool type contain this school type, IMMUNE damage.
9781 SpellImmuneList const& schoolList = m_spellImmune[IMMUNITY_SCHOOL];
9782 for (SpellImmuneList::const_iterator itr = schoolList.begin(); itr != schoolList.end(); ++itr)
9783 if ((itr->type & meleeSchoolMask) == meleeSchoolMask)
9784 return true;
9785
9786 return false;
9787}

References IMMUNITY_SCHOOL, m_spellImmune, and SPELL_SCHOOL_MASK_NONE.

Referenced by Spell::DoSpellHitOnUnit(), IsImmunedToDamageOrSchool(), IsImmunedToDamageOrSchool(), SpellHitResult(), and SpellHitResult().

◆ IsImmunedToSpell()

bool Unit::IsImmunedToSpell ( SpellInfo const *  spellInfo,
Spell const *  spell = nullptr 
)
virtual

Reimplemented in Creature.

9858{
9859 if (!spellInfo)
9860 return false;
9861
9862 // Single spell immunity.
9863 SpellImmuneList const& idList = m_spellImmune[IMMUNITY_ID];
9864 for (SpellImmuneList::const_iterator itr = idList.begin(); itr != idList.end(); ++itr)
9865 if (itr->type == spellInfo->Id)
9866 return true;
9867
9868 // xinef: my special immunity, if spellid is not on this list it means npc is immune
9869 SpellImmuneList const& allowIdList = m_spellImmune[IMMUNITY_ALLOW_ID];
9870 if (!allowIdList.empty())
9871 {
9872 for (SpellImmuneList::const_iterator itr = allowIdList.begin(); itr != allowIdList.end(); ++itr)
9873 if (itr->type == spellInfo->Id)
9874 return false;
9875 return true;
9876 }
9877
9878 if (spellInfo->HasAttribute(SPELL_ATTR0_NO_IMMUNITIES) && !HasSpiritOfRedemptionAura())
9879 return false;
9880
9881 if (spellInfo->Dispel)
9882 {
9883 SpellImmuneList const& dispelList = m_spellImmune[IMMUNITY_DISPEL];
9884 for (SpellImmuneList::const_iterator itr = dispelList.begin(); itr != dispelList.end(); ++itr)
9885 if (itr->type == spellInfo->Dispel)
9886 return true;
9887 }
9888
9889 // Spells that don't have effectMechanics.
9890 if (spellInfo->Mechanic)
9891 {
9892 SpellImmuneList const& mechanicList = m_spellImmune[IMMUNITY_MECHANIC];
9893 for (SpellImmuneList::const_iterator itr = mechanicList.begin(); itr != mechanicList.end(); ++itr)
9894 if (itr->type == spellInfo->Mechanic)
9895 return true;
9896 }
9897
9898 bool immuneToAllEffects = true;
9899 for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
9900 {
9901 // State/effect immunities applied by aura expect full spell immunity
9902 // Ignore effects with mechanic, they are supposed to be checked separately
9903 if (!spellInfo->Effects[i].IsEffect())
9904 continue;
9905
9906 // Xinef: if target is immune to one effect, and the spell has transform aura - it is immune to whole spell
9907 if (IsImmunedToSpellEffect(spellInfo, i))
9908 {
9909 if (spellInfo->HasAura(SPELL_AURA_TRANSFORM))
9910 return true;
9911 continue;
9912 }
9913
9914 immuneToAllEffects = false;
9915 break;
9916 }
9917 if (immuneToAllEffects) //Return immune only if the target is immune to all spell effects.
9918 return true;
9919
9920 if (spellInfo->Id != 42292 && spellInfo->Id != 59752 && spellInfo->Id != 19574 && spellInfo->Id != 34471)
9921 {
9922 SpellSchoolMask spellSchoolMask = spellInfo->GetSchoolMask();
9923 if (spell)
9924 {
9925 spellSchoolMask = spell->GetSpellSchoolMask();
9926 }
9927
9928 if (spellSchoolMask != SPELL_SCHOOL_MASK_NONE)
9929 {
9930 SpellImmuneList const& schoolList = m_spellImmune[IMMUNITY_SCHOOL];
9931 for (SpellImmuneList::const_iterator itr = schoolList.begin(); itr != schoolList.end(); ++itr)
9932 {
9933 SpellInfo const* immuneSpellInfo = sSpellMgr->GetSpellInfo(itr->spellId);
9934 if (((itr->type & spellSchoolMask) == spellSchoolMask)
9935 && (!immuneSpellInfo || immuneSpellInfo->IsPositive()) && !spellInfo->IsPositive()
9936 && !spellInfo->CanPierceImmuneAura(immuneSpellInfo))
9937 {
9938 return true;
9939 }
9940 }
9941 }
9942 }
9943
9944 return false;
9945}
@ IMMUNITY_ALLOW_ID
Definition SharedDefines.h:1412
@ IMMUNITY_ID
Definition SharedDefines.h:1411
@ IMMUNITY_MECHANIC
Definition SharedDefines.h:1410

References SpellInfo::CanPierceImmuneAura(), SpellInfo::Dispel, SpellInfo::Effects, SpellInfo::GetSchoolMask(), Spell::GetSpellSchoolMask(), SpellInfo::HasAttribute(), SpellInfo::HasAura(), HasSpiritOfRedemptionAura(), SpellInfo::Id, IMMUNITY_ALLOW_ID, IMMUNITY_DISPEL, IMMUNITY_ID, IMMUNITY_MECHANIC, IMMUNITY_SCHOOL, IsImmunedToSpellEffect(), SpellInfo::IsPositive(), m_spellImmune, MAX_SPELL_EFFECTS, SpellInfo::Mechanic, SPELL_ATTR0_NO_IMMUNITIES, SPELL_AURA_TRANSFORM, SPELL_SCHOOL_MASK_NONE, and sSpellMgr.

Referenced by AddAura(), Spell::DoSpellHitOnUnit(), Creature::IsImmunedToSpell(), boss_talon_king_ikiss::JustEngagedWith(), npc_pet_dk_ebon_gargoyle::MySelectNextTarget(), SpellHitResult(), and SpellHitResult().

◆ IsImmunedToSpellEffect()

bool Unit::IsImmunedToSpellEffect ( SpellInfo const *  spellInfo,
uint32  index 
) const
virtual

Reimplemented in Creature, and Totem.

9948{
9949 if (!spellInfo || !spellInfo->Effects[index].IsEffect())
9950 return false;
9951
9952 // xinef: pet scaling auras
9953 if (spellInfo->HasAttribute(SPELL_ATTR4_OWNER_POWER_SCALING))
9954 return false;
9955
9956 if (spellInfo->HasAttribute(SPELL_ATTR0_NO_IMMUNITIES) && !HasSpiritOfRedemptionAura())
9957 return false;
9958
9959 //If m_immuneToEffect type contain this effect type, IMMUNE effect.
9960 uint32 effect = spellInfo->Effects[index].Effect;
9961 SpellImmuneList const& effectList = m_spellImmune[IMMUNITY_EFFECT];
9962 for (SpellImmuneList::const_iterator itr = effectList.begin(); itr != effectList.end(); ++itr)
9963 {
9964 if (itr->type == effect && (itr->spellId != 62692 || (spellInfo->Effects[index].MiscValue == POWER_MANA && !CanRestoreMana(spellInfo))))
9965 {
9966 return true;
9967 }
9968 }
9969
9970 if (uint32 mechanic = spellInfo->Effects[index].Mechanic)
9971 {
9972 SpellImmuneList const& mechanicList = m_spellImmune[IMMUNITY_MECHANIC];
9973 for (SpellImmuneList::const_iterator itr = mechanicList.begin(); itr != mechanicList.end(); ++itr)
9974 if (itr->type == mechanic)
9975 return true;
9976 }
9977
9978 if (uint32 aura = spellInfo->Effects[index].ApplyAuraName)
9979 {
9981 for (SpellImmuneList::const_iterator itr = list.begin(); itr != list.end(); ++itr)
9982 {
9983 if (itr->type == aura && (itr->spellId != 64848 || (spellInfo->Effects[index].MiscValue == POWER_MANA && !CanRestoreMana(spellInfo))))
9984 {
9985 if (!spellInfo->HasAttribute(SPELL_ATTR3_ALWAYS_HIT))
9986 {
9987 if (itr->blockType == SPELL_BLOCK_TYPE_ALL || spellInfo->IsPositive()) // xinef: added for pet scaling
9988 {
9989 return true;
9990 }
9991 }
9992 }
9993 }
9994
9995 if (!spellInfo->HasAttribute(SPELL_ATTR2_NO_SCHOOL_IMMUNITIES))
9996 {
9997 // Check for immune to application of harmful magical effects
9999 for (AuraEffectList::const_iterator iter = immuneAuraApply.begin(); iter != immuneAuraApply.end(); ++iter)
10000 {
10001 if (/*(spellInfo->Dispel == DISPEL_MAGIC || spellInfo->Dispel == DISPEL_CURSE || spellInfo->Dispel == DISPEL_DISEASE) &&*/ // Magic debuff, xinef: all kinds?
10002 ((*iter)->GetMiscValue() & spellInfo->GetSchoolMask()) && // Check school
10003 !spellInfo->IsPositiveEffect(index) && // Harmful
10004 spellInfo->Effects[index].Effect != SPELL_EFFECT_PERSISTENT_AREA_AURA) // Not Persistent area auras
10005 {
10006 return true;
10007 }
10008 }
10009 }
10010 }
10011
10012 return false;
10013}
@ SPELL_EFFECT_PERSISTENT_AREA_AURA
Definition SharedDefines.h:816
@ SPELL_ATTR3_ALWAYS_HIT
Definition SharedDefines.h:522
@ IMMUNITY_STATE
Definition SharedDefines.h:1406
@ IMMUNITY_EFFECT
Definition SharedDefines.h:1405
@ SPELL_ATTR4_OWNER_POWER_SCALING
Definition SharedDefines.h:566
@ SPELL_AURA_MOD_IMMUNE_AURA_APPLY_SCHOOL
Definition SpellAuraDefines.h:330
@ SPELL_BLOCK_TYPE_ALL
Definition SpellDefines.h:159
bool CanRestoreMana(SpellInfo const *spellInfo) const
Definition Unit.cpp:17443

References CanRestoreMana(), SpellInfo::Effects, GetAuraEffectsByType(), SpellInfo::GetSchoolMask(), SpellInfo::HasAttribute(), HasSpiritOfRedemptionAura(), IMMUNITY_EFFECT, IMMUNITY_MECHANIC, IMMUNITY_STATE, SpellInfo::IsPositive(), SpellInfo::IsPositiveEffect(), m_spellImmune, POWER_MANA, SPELL_ATTR0_NO_IMMUNITIES, SPELL_ATTR2_NO_SCHOOL_IMMUNITIES, SPELL_ATTR3_ALWAYS_HIT, SPELL_ATTR4_OWNER_POWER_SCALING, SPELL_AURA_MOD_IMMUNE_AURA_APPLY_SCHOOL, SPELL_BLOCK_TYPE_ALL, and SPELL_EFFECT_PERSISTENT_AREA_AURA.

Referenced by AddAura(), Spell::AddUnitTarget(), Spell::DoSpellHitOnUnit(), spell_dk_death_grip::HandleBaseDummy(), IsImmunedToSpell(), and Creature::IsImmunedToSpellEffect().

◆ IsImmuneToAll()

bool Unit::IsImmuneToAll ( ) const
inline
919{ return IsImmuneToPC() && IsImmuneToNPC(); }

References IsImmuneToNPC(), and IsImmuneToPC().

◆ IsImmuneToNPC()

◆ IsImmuneToPC()

◆ isInAccessiblePlaceFor()

bool Unit::isInAccessiblePlaceFor ( Creature const *  c) const
4346{
4347 if (c->GetMapId() == MAP_THE_RING_OF_VALOR)
4348 {
4349 // skip transport check, check for being below floor level
4350 if (this->GetPositionZ() < 28.0f)
4351 return false;
4352 if (BattlegroundMap* bgMap = c->GetMap()->ToBattlegroundMap())
4353 if (Battleground* bg = bgMap->GetBG())
4354 if (bg->GetStartTime() < 80133) // 60000ms preparation time + 20133ms elevator rise time
4355 return false;
4356 }
4357 else if (c->GetMapId() == MAP_ICECROWN_CITADEL)
4358 {
4359 // if static transport doesn't match - return false
4360 if (c->GetTransport() != this->GetTransport() && ((c->GetTransport() && c->GetTransport()->IsStaticTransport()) || (this->GetTransport() && this->GetTransport()->IsStaticTransport())))
4361 return false;
4362
4363 // special handling for ICC (map 631), for non-flying pets in Gunship Battle, for trash npcs this is done via CanAIAttack
4364 if (c->GetOwnerGUID().IsPlayer() && !c->CanFly())
4365 {
4366 if (c->GetTransport() != this->GetTransport())
4367 return false;
4368 if (this->GetTransport())
4369 {
4370 if (c->GetPositionY() < 2033.0f)
4371 {
4372 if (this->GetPositionY() > 2033.0f)
4373 return false;
4374 }
4375 else if (c->GetPositionY() < 2438.0f)
4376 {
4377 if (this->GetPositionY() < 2033.0f || this->GetPositionY() > 2438.0f)
4378 return false;
4379 }
4380 else if (this->GetPositionY() < 2438.0f)
4381 return false;
4382 }
4383 }
4384 }
4385 else
4386 {
4387 // pussywizard: prevent any bugs by passengers exiting transports or normal creatures flying away
4388 if (c->GetTransport() != this->GetTransport())
4389 return false;
4390 }
4391
4392 LiquidStatus liquidStatus = GetLiquidData().Status;
4393 bool isInWater = (liquidStatus & MAP_LIQUID_STATUS_IN_CONTACT) != 0;
4394
4395 // In water or jumping in water
4396 if (isInWater || (liquidStatus == LIQUID_MAP_ABOVE_WATER && (IsFalling() || (ToPlayer() && ToPlayer()->IsFalling()))))
4397 {
4398 return c->CanEnterWater();
4399 }
4400 else
4401 {
4402 return c->CanWalk() || c->CanFly();
4403 }
4404}
@ MAP_THE_RING_OF_VALOR
Definition AreaDefines.h:262
@ MAP_ICECROWN_CITADEL
Definition AreaDefines.h:266
#define MAP_LIQUID_STATUS_IN_CONTACT
Definition GridTerrainData.h:32
LiquidStatus
Definition GridTerrainData.h:190
@ LIQUID_MAP_ABOVE_WATER
Definition GridTerrainData.h:192
Definition Map.h:681
BattlegroundMap * ToBattlegroundMap()
Definition Map.h:381
bool IsFalling() const
Definition Unit.cpp:16046
LiquidData const & GetLiquidData() const
Definition Object.cpp:3115
LiquidStatus Status
Definition GridTerrainData.h:206

References Creature::CanEnterWater(), Creature::CanFly(), Creature::CanWalk(), WorldObject::GetLiquidData(), WorldObject::GetMap(), WorldLocation::GetMapId(), GetOwnerGUID(), Position::GetPositionY(), Position::GetPositionZ(), WorldObject::GetTransport(), IsFalling(), ObjectGuid::IsPlayer(), GameObject::IsStaticTransport(), LIQUID_MAP_ABOVE_WATER, MAP_ICECROWN_CITADEL, MAP_LIQUID_STATUS_IN_CONTACT, MAP_THE_RING_OF_VALOR, LiquidData::Status, Map::ToBattlegroundMap(), and Object::ToPlayer().

Referenced by npc_escortAI::AssistPlayerInCombatAgainst(), Creature::CanCreatureAttack(), ChaseMovementGenerator< T >::DoUpdate(), FollowerAI::MoveInLineOfSight(), npc_escortAI::MoveInLineOfSight(), npc_pet_hunter_snake_trap::MoveInLineOfSight(), and HostileReference::updateOnlineStatus().

◆ isInBackInMap()

bool Unit::isInBackInMap ( Unit const *  target,
float  distance,
float  arc = M_PI 
) const

◆ IsInCombat()

bool Unit::IsInCombat ( ) const
inline

References HasUnitFlag(), and UNIT_FLAG_IN_COMBAT.

Referenced by _IsValidAttackTarget(), Player::ActivateTaxiPathTo(), npc_anubisath_sentinel::aqsentinelAI::CallBuddiesToAttack(), npc_argent_captainAI::CanAIAttack(), Player::CanEquipItem(), Creature::CanPeriodicallyCallForAssistance(), Player::CanUnequipItem(), boss_high_nethermancer_zerevor::CastDampenMagicIfPossible(), spell_hun_disengage::CheckCast(), Spell::CheckCast(), SpellInfo::CheckTarget(), instance_blackrock_depths::instance_blackrock_depths_InstanceMapScript::CheckTombReset(), CombatStart(), npc_centrifuge_construct::npc_centrifuge_constructAI::DamageTaken(), boss_prince_valanar_icc::boss_prince_valanarAI::DoAction(), npc_ball_of_flame::npc_ball_of_flameAI::DoAction(), boss_lady_deathwhisper::boss_lady_deathwhisperAI::DoAction(), boss_the_lich_king::boss_the_lich_kingAI::DoAction(), npc_green_dragon_combat_trigger::npc_green_dragon_combat_triggerAI::DoAction(), npc_risen_archmage::npc_risen_archmageAI::DoAction(), boss_algalon_the_observer::DoAction(), boss_felblood_kaelthas::DoAction(), boss_kelthuzad_minion::boss_kelthuzad_minionAI::DoAction(), UnitAI::DoAddAuraToAllHostilePlayers(), Spell::DoAllEffectOnTarget(), UnitAI::DoCastToAllHostilePlayers(), Spell::DoSpellHitOnUnit(), Spell::EffectActivateRune(), npc_clintar_spirit::npc_clintar_spiritAI::EnterEvadeMode(), boss_professor_putricide::boss_professor_putricideAI::EnterEvadeMode(), gunship_npc_AI::EnterEvadeMode(), npc_gunship_boarding_addAI::EnterEvadeMode(), Player::EquipItem(), CastRunesEvent::Execute(), GetVelocity(), spell_apothecary_lingering_fumes::HandleAfterCast(), WorldSession::HandleBattlefieldLeaveOpcode(), WorldSession::HandleBattleFieldPortOpcode(), spell_dred_raptor_call::HandleDummy(), spell_mc_play_dead_aura::HandleEffectRemove(), WorldSession::HandleEquipmentSetUse(), boss_sartharion_dragonAI::HandleExtraEvent(), spell_chapter5_return_to_capital::HandleHit(), boss_malygos::HandleIntroSpeech(), WorldSession::HandleLogoutRequestOpcode(), WorldSession::HandleMessagechatOpcode(), WorldSession::HandlePetCastSpellOpcode(), WorldSession::HandleSetRaidDifficultyOpcode(), ArenaSpectator::HandleSpectatorSpectateCommand(), spell_putricide_mutated_transformation::HandleSummon(), WorldSession::HandleSummonResponseOpcode(), tele_commandscript::HandleTeleCommand(), misc_commandscript::HandleUnstuckCommand(), WorldSession::HandleUseItemOpcode(), npc_pet_mage_mirror_image::InitializeAI(), IsEngaged(), Creature::IsUpdateNeeded(), npc_highlord_darion_mograine::npc_highlord_darion_mograineAI::JustSummoned(), boss_anubrekhan::JustSummoned(), boss_kelthuzad::boss_kelthuzadAI::JustSummoned(), npc_kiljaeden_controller::JustSummoned(), boss_professor_putricide::boss_professor_putricideAI::JustSummoned(), boss_rotface::boss_rotfaceAI::JustSummoned(), boss_nexusprince_shaffar::JustSummoned(), npc_nelson::npc_nelsonAI::JustSummoned(), Pet::LoseHappiness(), CreatureGroup::MemberEvaded(), CreatureAI::MoveInLineOfSight(), boss_muru::MoveInLineOfSight(), boss_eye_of_cthun::MoveInLineOfSight(), boss_anubarak_trial::boss_anubarak_trialAI::MoveInLineOfSight(), npc_icc_valkyr_herald::npc_icc_valkyr_heraldAI::MoveInLineOfSight(), npc_icc_vengeful_fleshreaper::npc_icc_vengeful_fleshreaperAI::MoveInLineOfSight(), boss_kelthuzad::boss_kelthuzadAI::MoveInLineOfSight(), boss_razorscale::MovementInform(), boss_alar::MovementInform(), npc_pet_mage_mirror_image::MySelectNextTarget(), npc_death_knight_initiate::OnGossipHello(), npc_ulduar_expedition_commander::OnGossipHello(), go_ulduar_working_harpoon::OnGossipHello(), npc_death_knight_initiate::OnGossipSelect(), npc_ulduar_expedition_commander::OnGossipSelect(), icecrown_citadel_teleport::OnGossipSelect(), BossAI::OnSpellCastFinished(), at_frozen_throne_teleport::OnTrigger(), at_naxxramas_hub_portal::OnTrigger(), AreaTrigger_at_legion_teleporter::OnTrigger(), RisenArchmageCheck::operator()(), Acore::MostHPMissingInRange::operator()(), Acore::MostHPPercentMissingInRange::operator()(), Acore::FriendlyCCedInRange::operator()(), Acore::FriendlyMissingBuffInRange::operator()(), Acore::AnyAttackableUnitExceptForOriginalCasterInObjectRangeCheck::operator()(), npc_scarlet_ghoul::npc_scarlet_ghoulAI::OwnerAttackedBy(), boss_kologarn::PassengerBoarded(), SmartScript::ProcessEvent(), Creature::Regenerate(), Player::Regenerate(), Player::RegenerateAll(), Player::RegenerateHealth(), boss_kiljaeden::Reset(), spell_item_crazy_alchemists_potion::SecondaryEffect(), boss_gluth::boss_gluthAI::SelectPlayerInRoom(), instance_naxxramas::SetBossState(), boss_grand_warlock_nethekurse::SetData(), SetInCombatState(), SetSpeed(), boss_prince_keleseth_icc::boss_prince_kelesethAI::SpellHit(), boss_prince_taldaram_icc::boss_prince_taldaramAI::SpellHit(), boss_prince_valanar_icc::boss_prince_valanarAI::SpellHit(), boss_the_lich_king::boss_the_lich_kingAI::SpellHit(), Spell::SummonGuardian(), lfg::LFGMgr::TeleportPlayer(), instance_stratholme::instance_stratholme_InstanceMapScript::Update(), Creature::Update(), TempSummon::Update(), Update(), DistractMovementGenerator::Update(), TotemAI::UpdateAI(), SimpleCharmedAI::UpdateAI(), npc_scarlet_ghoul::npc_scarlet_ghoulAI::UpdateAI(), npc_scarlet_courier::npc_scarlet_courierAI::UpdateAI(), boss_kirtonos_the_herald::boss_kirtonos_the_heraldAI::UpdateAI(), boss_thekal::UpdateAI(), npc_zealot_lorkhan::UpdateAI(), npc_zealot_zath::UpdateAI(), npc_arthas::npc_arthasAI::UpdateAI(), npc_clintar_spirit::npc_clintar_spiritAI::UpdateAI(), boss_faction_championsAI::UpdateAI(), npc_pos_leader::npc_pos_leaderAI::UpdateAI(), boss_moorabi::boss_moorabiAI::UpdateAI(), boss_prince_valanar_icc::boss_prince_valanarAI::UpdateAI(), npc_green_dragon_combat_trigger::npc_green_dragon_combat_triggerAI::UpdateAI(), npc_risen_archmage::npc_risen_archmageAI::UpdateAI(), npc_frost_freeze_trap::npc_frost_freeze_trapAI::UpdateAI(), npc_frostwing_vrykul::npc_frostwing_vrykulAI::UpdateAI(), boss_grobbulus::boss_grobbulusAI::UpdateAI(), boss_thaddius_summon::boss_thaddius_summonAI::UpdateAI(), boss_urom::boss_uromAI::UpdateAI(), boss_stormcaller_brundir::UpdateAI(), boss_hodir::UpdateAI(), boss_mimiron::UpdateAI(), npc_ulduar_expedition_engineer::UpdateAI(), npc_llod_generic::npc_llod_genericAI::UpdateAI(), npc_boneguard_footman::npc_boneguard_footmanAI::UpdateAI(), npc_millhouse_manastorm::npc_millhouse_manastormAI::UpdateAI(), npc_pet_mage_mirror_image::UpdateAI(), npc_pet_shaman_earth_elemental::UpdateAI(), npc_pet_shaman_fire_elemental::UpdateAI(), boss_taerar::boss_taerarAI::UpdateAI(), npc_simone::npc_simoneAI::UpdateAI(), PassiveAI::UpdateAI(), PetAI::UpdateAI(), Player::UpdateContestedPvP(), Creature::UpdateEntry(), boss_bjarngrim::UpdateEscortAI(), InstanceScript::UpdateMinionState(), SmartAI::UpdatePath(), Player::UpdatePotionCooldown(), and npc_ancestral_wolf::npc_ancestral_wolfAI::WaypointReached().

◆ IsInCombatWith()

bool Unit::IsInCombatWith ( Unit const *  who) const
17250{
17251 // Check target exists
17252 if (!who)
17253 return false;
17254 // Search in threat list
17255 ObjectGuid guid = who->GetGUID();
17256 for (ThreatContainer::StorageType::const_iterator i = m_ThreatMgr.GetThreatList().begin(); i != m_ThreatMgr.GetThreatList().end(); ++i)
17257 {
17258 HostileReference* ref = (*i);
17259 // Return true if the unit matches
17260 if (ref && ref->getUnitGuid() == guid)
17261 return true;
17262 }
17263 // Nothing found, false.
17264 return false;
17265}
Definition ThreatMgr.h:48
ObjectGuid getUnitGuid() const
Definition ThreatMgr.h:106
ThreatContainer::StorageType const & GetThreatList() const
Definition ThreatMgr.h:277

References Object::GetGUID(), ThreatMgr::GetThreatList(), HostileReference::getUnitGuid(), and m_ThreatMgr.

Referenced by _IsValidAttackTarget(), DealDamage(), Spell::DoAllEffectOnTarget(), TemporaryThreatModifierEvent::Execute(), IsEngagedBy(), and Acore::NearestAttackableUnitInObjectRangeCheck::operator()().

◆ IsInDisallowedMountForm()

bool Unit::IsInDisallowedMountForm ( ) const
17479{
17480 if (SpellInfo const* transformSpellInfo = sSpellMgr->GetSpellInfo(getTransForm()))
17481 {
17482 if (transformSpellInfo->HasAttribute(SPELL_ATTR0_ALLOW_WHILE_MOUNTED))
17483 {
17484 return false;
17485 }
17486 }
17487
17488 if (ShapeshiftForm form = GetShapeshiftForm())
17489 {
17490 SpellShapeshiftFormEntry const* shapeshift = sSpellShapeshiftFormStore.LookupEntry(form);
17491 if (!shapeshift)
17492 {
17493 return true;
17494 }
17495
17496 if (!(shapeshift->flags1 & SHAPESHIFT_FLAG_STANCE))
17497 {
17498 return true;
17499 }
17500 }
17501
17503 {
17504 return false;
17505 }
17506
17507 CreatureDisplayInfoEntry const* display = sCreatureDisplayInfoStore.LookupEntry(GetDisplayId());
17508 if (!display)
17509 {
17510 return true;
17511 }
17512
17514 if (!displayExtra)
17515 {
17516 return true;
17517 }
17518
17519 CreatureModelDataEntry const* model = sCreatureModelDataStore.LookupEntry(display->ModelId);
17520 ChrRacesEntry const* race = sChrRacesStore.LookupEntry(displayExtra->DisplayRaceID);
17521
17522 if (model && !(model->HasFlag(CREATURE_MODEL_DATA_FLAGS_CAN_MOUNT)))
17523 {
17524 if (race && !(race->HasFlag(CHRRACES_FLAGS_CAN_MOUNT)))
17525 {
17526 return true;
17527 }
17528 }
17529
17530 return false;
17531}
@ CHRRACES_FLAGS_CAN_MOUNT
Definition DBCStructure.h:675
@ CREATURE_MODEL_DATA_FLAGS_CAN_MOUNT
Definition DBCStructure.h:771
@ SPELL_ATTR0_ALLOW_WHILE_MOUNTED
Definition SharedDefines.h:417
@ SHAPESHIFT_FLAG_STANCE
Definition UnitDefines.h:104
uint32 getTransForm() const
Definition Unit.h:1951
bool HasFlag(ChrRacesFlags flag) const
Definition DBCStructure.h:700
uint32 ExtendedDisplayInfoID
Definition DBCStructure.h:725
uint32 DisplayRaceID
Definition DBCStructure.h:741
bool HasFlag(CreatureModelDataFlags flag) const
Definition DBCStructure.h:804
uint32 flags1
Definition DBCStructure.h:1822

References CHRRACES_FLAGS_CAN_MOUNT, CREATURE_MODEL_DATA_FLAGS_CAN_MOUNT, CreatureDisplayInfoExtraEntry::DisplayRaceID, CreatureDisplayInfoEntry::ExtendedDisplayInfoID, SpellShapeshiftFormEntry::flags1, GetDisplayId(), GetNativeDisplayId(), GetShapeshiftForm(), getTransForm(), ChrRacesEntry::HasFlag(), CreatureModelDataEntry::HasFlag(), CreatureDisplayInfoEntry::ModelId, sChrRacesStore, sCreatureDisplayInfoExtraStore, sCreatureDisplayInfoStore, sCreatureModelDataStore, SHAPESHIFT_FLAG_STANCE, SPELL_ATTR0_ALLOW_WHILE_MOUNTED, sSpellMgr, and sSpellShapeshiftFormStore.

Referenced by Player::ActivateTaxiPathTo(), npc_toc5_player_vehicle::npc_toc5_player_vehicleAI::BeforeSpellClick(), Spell::CheckCast(), Player::ContinueTaxiFlight(), and Player::ProcessDelayedOperations().

◆ IsInFeralForm()

bool Unit::IsInFeralForm ( ) const
inline
1944 {
1946 return form == FORM_CAT || form == FORM_BEAR || form == FORM_DIREBEAR || form == FORM_GHOSTWOLF; // Xinef: added shamans Ghost Wolf, should behave exactly like druid forms
1947 }
@ FORM_DIREBEAR
Definition UnitDefines.h:77
@ FORM_CAT
Definition UnitDefines.h:70
@ FORM_GHOSTWOLF
Definition UnitDefines.h:85
@ FORM_BEAR
Definition UnitDefines.h:74

References FORM_BEAR, FORM_CAT, FORM_DIREBEAR, FORM_GHOSTWOLF, and GetShapeshiftForm().

Referenced by Player::_ApplyWeaponDamage(), Player::CalculateMinMaxDamage(), spell_dru_survival_instincts::CheckCast(), Aura::GetProcEffectMask(), Player::GetWeaponForAttack(), GetWeaponSkillValue(), AuraEffect::HandleAuraModDisarm(), Player::UpdateAttackPowerAndDamage(), and Player::UpdateWeaponSkill().

◆ IsInFlight()

bool Unit::IsInFlight ( ) const
inline

References HasUnitState(), and UNIT_STATE_IN_FLIGHT.

Referenced by Player::CheckAreaExploreAndOutdoor(), Spell::CheckCast(), SpellInfo::CheckTarget(), CreatureUnitRelocationWorker(), DealDamageMods(), DealMeleeDamage(), DealSpellDamage(), go_commandscript::DoTeleport(), go_commandscript::DoTeleportToTransport(), Spell::EffectJump(), Spell::EffectJumpDest(), Spell::EffectLeap(), Spell::EffectStuck(), Spell::EffectTeleportUnits(), Spell::EffectTeleUnitsFaceCaster(), Player::GetNPCIfCanInteractWith(), misc_commandscript::HandleAppearCommand(), WorldSession::HandleAreaTriggerOpcode(), WorldSession::HandleCancelMountAuraOpcode(), misc_commandscript::HandleDismountCommand(), go_commandscript::HandleGoGraveyardCommand(), go_commandscript::HandleGoGridCommand(), go_commandscript::HandleGoTicketCommand(), go_commandscript::HandleGoZoneXYCommand(), misc_commandscript::HandleGroupSummonCommand(), WorldSession::HandleHearthAndResurrect(), WorldSession::HandleInitiateTradeOpcode(), WorldSession::HandleLogoutRequestOpcode(), Battlefield::HandlePlayerEnterZone(), misc_commandscript::HandleSkirmishCommand(), ArenaSpectator::HandleSpectatorSpectateCommand(), tele_commandscript::HandleTeleCommand(), tele_commandscript::HandleTeleGroupCommand(), misc_commandscript::HandleUnstuckCommand(), Battlefield::InvitePlayerToWar(), Player::IsFalling(), Player::IsOutdoorPvPActive(), IsValidCombatTarget(), item_only_for_flight::OnUse(), WorldSession::ProcessMovementInfo(), Player::ProcessTerrainStatusUpdate(), SetStunned(), Player::TeleportTo(), and Player::UpdatePvPState().

◆ isInFrontInMap()

bool Unit::isInFrontInMap ( Unit const *  target,
float  distance,
float  arc = M_PI 
) const
4336{
4337 return IsWithinDistInMap(target, distance) && HasInArc(arc, target);
4338}

References Position::HasInArc(), and WorldObject::IsWithinDistInMap().

◆ IsInnkeeper()

bool Unit::IsInnkeeper ( ) const
inline
@ UNIT_NPC_FLAG_INNKEEPER
Definition UnitDefines.h:335

References HasNpcFlag(), and UNIT_NPC_FLAG_INNKEEPER.

Referenced by npc_innkeeper::OnGossipHello().

◆ IsInPartyWith()

bool Unit::IsInPartyWith ( Unit const *  unit) const
15141{
15142 if (this == unit)
15143 return true;
15144
15145 Unit const* u1 = GetCharmerOrOwnerOrSelf();
15146 Unit const* u2 = unit->GetCharmerOrOwnerOrSelf();
15147 if (u1 == u2)
15148 return true;
15149
15150 if (u1->IsPlayer() && u2->IsPlayer())
15151 return u1->ToPlayer()->IsInSameGroupWith(u2->ToPlayer());
15152 // Xinef: we assume that npcs with the same faction are in party
15153 else if (u1->IsCreature() && u2->IsCreature() && !u1->IsControlledByPlayer() && !u2->IsControlledByPlayer())
15154 return u1->GetFaction() == u2->GetFaction();
15155 // Xinef: creature type_flag should work for party check only if player group is not a raid
15158 return true;
15159 else
15160 return false;
15161}
bool isRaidGroup() const
Definition Group.cpp:2281
bool IsInSameGroupWith(Player const *p) const
Definition Player.cpp:2295

References CREATURE_TYPE_FLAG_TREAT_AS_RAID_UNIT, GetCharmerOrOwnerOrSelf(), Creature::GetCreatureTemplate(), GetFaction(), Player::GetGroup(), IsControlledByPlayer(), Object::IsCreature(), Player::IsInSameGroupWith(), Object::IsPlayer(), Group::isRaidGroup(), Object::ToCreature(), Object::ToPlayer(), and CreatureTemplate::type_flags.

Referenced by SpellInfo::CheckExplicitTarget(), SpellClickInfo::IsFitToRequirements(), Condition::Meets(), Acore::AnyGroupedUnitInObjectRangeCheck::operator()(), and Acore::WorldObjectSpellTargetCheck::operator()().

◆ IsInRaidWith()

bool Unit::IsInRaidWith ( Unit const *  unit) const
15164{
15165 if (this == unit)
15166 return true;
15167
15168 Unit const* u1 = GetCharmerOrOwnerOrSelf();
15169 Unit const* u2 = unit->GetCharmerOrOwnerOrSelf();
15170 if (u1 == u2)
15171 return true;
15172
15173 if (u1->IsPlayer() && u2->IsPlayer())
15174 return u1->ToPlayer()->IsInSameRaidWith(u2->ToPlayer());
15175 // Xinef: we assume that npcs with the same faction are in party
15176 else if (u1->IsCreature() && u2->IsCreature() && !u1->IsControlledByPlayer() && !u2->IsControlledByPlayer())
15177 return u1->GetFaction() == u2->GetFaction();
15180 return true;
15181 else
15182 return false;
15183}

References CREATURE_TYPE_FLAG_TREAT_AS_RAID_UNIT, GetCharmerOrOwnerOrSelf(), Creature::GetCreatureTemplate(), GetFaction(), IsControlledByPlayer(), Object::IsCreature(), Player::IsInSameRaidWith(), Object::IsPlayer(), Object::ToCreature(), Object::ToPlayer(), and CreatureTemplate::type_flags.

Referenced by Corpse::BuildValuesUpdate(), SpellInfo::CheckExplicitTarget(), spell_dru_t10_restoration_4p_bonus::FilterTargets(), GetReactionTo(), WorldSession::HandleLootMasterGiveOpcode(), SpellClickInfo::IsFitToRequirements(), Condition::Meets(), Acore::AnyGroupedUnitInObjectRangeCheck::operator()(), Acore::WorldObjectSpellTargetCheck::operator()(), and PatchValuesUpdate().

◆ IsInSanctuary()

bool Unit::IsInSanctuary ( ) const
inline

◆ IsInWater()

◆ IsLevitating()

◆ IsMounted()

◆ IsMovementPreventedByCasting()

bool Unit::IsMovementPreventedByCasting ( ) const
virtual

Reimplemented in Creature.

4312{
4313 // can always move when not casting
4315 {
4316 return false;
4317 }
4318
4319 // channeled spells during channel stage (after the initial cast timer) allow movement with a specific spell attribute
4321 {
4322 if (spell->getState() != SPELL_STATE_FINISHED && spell->IsChannelActive())
4323 {
4324 if (spell->GetSpellInfo()->IsActionAllowedChannel())
4325 {
4326 return false;
4327 }
4328 }
4329 }
4330
4331 // prohibit movement for all other spell casts
4332 return true;
4333}
@ UNIT_STATE_CASTING
Definition UnitDefines.h:185

References CURRENT_CHANNELED_SPELL, HasUnitState(), m_currentSpells, SPELL_STATE_FINISHED, and UNIT_STATE_CASTING.

Referenced by TimedFleeingMovementGenerator::Update().

◆ isMoving()

◆ IsNeutralToAll()

bool Unit::IsNeutralToAll ( ) const
7224{
7225 FactionTemplateEntry const* my_faction = GetFactionTemplateEntry();
7226 if (!my_faction || !my_faction->faction)
7227 return true;
7228
7229 FactionEntry const* raw_faction = sFactionStore.LookupEntry(my_faction->faction);
7230 if (raw_faction && raw_faction->reputationListID >= 0)
7231 return false;
7232
7233 return my_faction->IsNeutralToAll();
7234}
bool IsNeutralToAll() const
Definition DBCStructure.h:984

References FactionTemplateEntry::faction, GetFactionTemplateEntry(), FactionTemplateEntry::IsNeutralToAll(), FactionEntry::reputationListID, and sFactionStore.

Referenced by Creature::_IsTargetAcceptable(), Creature::CanStartAttack(), AggressorAI::Permissible(), and ReactorAI::Permissible().

◆ IsNonMeleeSpellCast()

bool Unit::IsNonMeleeSpellCast ( bool  withDelayed,
bool  skipChanneled = false,
bool  skipAutorepeat = false,
bool  isAutoshoot = false,
bool  skipInstant = true 
) const
4243{
4244 // We don't do loop here to explicitly show that melee spell is excluded.
4245 // Maybe later some special spells will be excluded too.
4246
4247 // generic spells are cast when they are not finished and not delayed
4250 (withDelayed || m_currentSpells[CURRENT_GENERIC_SPELL]->getState() != SPELL_STATE_DELAYED))
4251 {
4252 if (!skipInstant || m_currentSpells[CURRENT_GENERIC_SPELL]->GetCastTime())
4253 {
4254 if (!isAutoshoot || !m_currentSpells[CURRENT_GENERIC_SPELL]->m_spellInfo->HasAttribute(SPELL_ATTR2_DO_NOT_RESET_COMBAT_TIMERS))
4255 return true;
4256 }
4257 }
4258 // channeled spells may be delayed, but they are still considered cast
4259 if (!skipChanneled && m_currentSpells[CURRENT_CHANNELED_SPELL] &&
4261 {
4262 if (!isAutoshoot || !m_currentSpells[CURRENT_CHANNELED_SPELL]->m_spellInfo->HasAttribute(SPELL_ATTR2_DO_NOT_RESET_COMBAT_TIMERS))
4263 return true;
4264 }
4265 // autorepeat spells may be finished or delayed, but they are still considered cast
4266 if (!skipAutorepeat && m_currentSpells[CURRENT_AUTOREPEAT_SPELL])
4267 return true;
4268
4269 return false;
4270}
@ SPELL_ATTR2_DO_NOT_RESET_COMBAT_TIMERS
Definition SharedDefines.h:484

References CURRENT_AUTOREPEAT_SPELL, CURRENT_CHANNELED_SPELL, CURRENT_GENERIC_SPELL, m_currentSpells, SPELL_ATTR2_DO_NOT_RESET_COMBAT_TIMERS, SPELL_STATE_DELAYED, and SPELL_STATE_FINISHED.

Referenced by Spell::_cast(), _UpdateAutoRepeatSpell(), Player::ActivateSpec(), Player::ActivateTaxiPathTo(), Player::CanEquipItem(), Player::CanExecutePendingSpellCastRequest(), CombatStop(), npc_molten_golem::DamageTaken(), ScriptedAI::DoCastSpell(), Spell::EffectKnockBack(), Spell::finish(), WorldSession::HandleCancelCastOpcode(), WorldSession::HandleSetRaidDifficultyOpcode(), isSpellBlocked(), boss_shade_of_aran::JustEngagedWith(), boss_pandemonius::JustEngagedWith(), MeleeSpellHitResult(), Spell::prepare(), SmartScript::ProcessEvent(), RollMeleeOutcomeAgainst(), setDeathState(), StopAttackFaction(), boss_netherspite::SwitchToPortalPhase(), Player::TeleportTo(), TotemAI::UpdateAI(), npc_chesspiece::UpdateAI(), npc_hor_lich_king::npc_hor_lich_kingAI::UpdateAI(), npc_putricide_oozeAI::UpdateAI(), npc_icc_ice_sphere::npc_icc_ice_sphereAI::UpdateAI(), npc_vh_teleportation_portal::npc_vh_teleportation_portalAI::UpdateAI(), npc_warmage_violetstand::UpdateAI(), and npc_deaths_fel_cannon::npc_deaths_fel_cannonAI::UpdateAI().

◆ IsOnVehicle()

◆ IsPet()

bool Unit::IsPet ( ) const
inline
791{ return m_unitTypeMask & UNIT_MASK_PET; }
@ UNIT_MASK_PET
Definition UnitDefines.h:160

References m_unitTypeMask, and UNIT_MASK_PET.

Referenced by Spell::_cast(), Spell::AddUnitTarget(), spell_warl_demonic_pact_aura::AfterCheckProc(), Creature::AllLootRemovedFromCorpse(), BeforeVisibilityDestroy< Creature >(), Creature::CallAssistance(), Creature::CallForHelp(), boss_renataki::boss_renatakiAI::CanAlwaysBeDetectable(), boss_renataki::boss_renatakiAI::CanSeeAlways(), Creature::CanSwim(), spell_warl_demonic_pact::CheckProc(), ClearInCombat(), CombatStart(), Creature::CreateFromProto(), Player::CreatePet(), DealDamage(), MotionTransport::DelayedTeleportTransport(), ChaseMovementGenerator< T >::DispatchSplineToPosition(), PetAI::DoAttack(), ChaseMovementGenerator< T >::DoUpdate(), Spell::EffectDismissPet(), Spell::EffectForceDeselect(), Spell::EffectRenamePet(), Spell::EffectSanctuary(), Spell::EffectSchoolDMG(), Spell::EffectTameCreature(), Acore::XP::Gain(), Creature::GetAggroRange(), GetCastingTimeForBonus(), GetCombatRatingReduction(), GetCreatePowers(), GetNextRandomRaidMemberOrPet(), GetRandomContactPoint(), GetVelocity(), AuraEffect::HandleAuraModResistance(), AuraEffect::HandleAuraModResistanceExclusive(), AuraEffect::HandleAuraModStat(), debug_commandscript::HandleDebugThreatListCommand(), AuraEffect::HandleFeignDeath(), modify_commandscript::HandleModifyTalentCommand(), AuraEffect::HandleModPossessPet(), AuraEffect::HandleModResistancePercent(), AuraEffect::HandleModTotalPercentStat(), npc_commandscript::HandleNpcDeleteCommand(), npc_commandscript::HandleNpcSetLevelCommand(), npc_commandscript::HandleNpcSetModelCommand(), npc_commandscript::HandleNpcSetMoveTypeCommand(), npc_commandscript::HandleNpcSetPhaseCommand(), npc_commandscript::HandleNpcTameCommand(), WorldSession::HandlePetAbandon(), WorldSession::HandlePetActionHelper(), WorldSession::HandlePetCastSpellOpcode(), pet_commandscript::HandlePetCreateCommand(), WorldSession::HandlePetRename(), WorldSession::HandlePetSetAction(), misc_commandscript::HandleRespawnCommand(), Creature::InitEntry(), TempSummon::InitStats(), Guardian::InitStatsForLevel(), DisableMgr::IsDisabledFor(), Creature::isElite(), Minion::IsGuardianPet(), Player::isHonorOrXPTarget(), Creature::isWorldBoss(), npc_webbed_creature::npc_webbed_creatureAI::JustDied(), npc_underbat::JustEngagedWith(), npc_vekniss_stinger::JustEngagedWith(), boss_murmur::JustEngagedWith(), Kill(), spell_hun_target_self_and_pet::Load(), ModSpellCastTime(), CreatureAI::MoveBackwardsChecks(), CreatureAI::MoveCircleChecks(), npc_cos_stratholme_citizien::npc_cos_stratholme_citizienAI::MoveInLineOfSight(), boss_kelthuzad_minion::boss_kelthuzad_minionAI::MoveInLineOfSight(), Acore::MostHPMissingGroupInRange::operator()(), PetAI::ReceiveEmote(), RollMeleeOutcomeAgainst(), FactorySelector::SelectAI(), Creature::SelectLevel(), WorldSession::SendPetNameQuery(), Spell::SendSpellGo(), Spell::SendSpellStart(), SetCharm(), Creature::SetDisplayId(), SetHealth(), SetInCombatState(), SetMinion(), Creature::SetObjectScale(), setPowerType(), SpellDamageBonusDone(), SpellPctDamageModsDone(), ToPet(), TempSummon::UnSummon(), Update(), boss_vaelastrasz::boss_vaelAI::UpdateAI(), boss_hazzarah::UpdateAI(), PetAI::UpdateAI(), Player::UpdateAreaDependentAuras(), UpdateAuraForGroup(), Creature::UpdateEntry(), Creature::UpdateMoveInLineOfSightState(), UpdateSpeed(), and UpdateSplinePosition().

◆ IsPetAura()

bool Unit::IsPetAura ( Aura const *  aura)
13851{
13852 Unit* owner = GetOwner();
13853
13854 if (!owner || !owner->IsPlayer())
13855 return false;
13856
13857 // if the owner has that pet aura, return true
13858 for (PetAura const* petAura : owner->m_petAuras)
13859 if (petAura->GetAura(GetEntry()) == aura->GetId())
13860 return true;
13861
13862 return false;
13863}
Definition SpellMgr.h:457
Aura * GetAura(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint8 reqEffMask=0) const
Definition Unit.cpp:5806
uint32 GetId(std::string const &username)
Definition AccountMgr.cpp:236

References Object::GetEntry(), Aura::GetId(), GetOwner(), Object::IsPlayer(), and m_petAuras.

Referenced by Pet::_SaveAuras(), and Spell::EffectSummonPet().

◆ IsPetInCombat()

bool Unit::IsPetInCombat ( ) const
inline

◆ IsPolymorphed()

bool Unit::IsPolymorphed ( ) const
13244{
13245 uint32 transformId = getTransForm();
13246 if (!transformId)
13247 return false;
13248
13249 SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(transformId);
13250 if (!spellInfo)
13251 return false;
13252
13253 return spellInfo->GetSpellSpecific() == SPELL_SPECIFIC_MAGE_POLYMORPH;
13254}
@ SPELL_SPECIFIC_MAGE_POLYMORPH
Definition SpellInfo.h:160
SpellSpecificType GetSpellSpecific() const
Definition SpellInfo.cpp:2028

References SpellInfo::GetSpellSpecific(), getTransForm(), SPELL_SPECIFIC_MAGE_POLYMORPH, and sSpellMgr.

Referenced by Attack(), AuraEffect::HandleAuraModShapeshift(), AuraEffect::HandleAuraTransform(), Player::RegenerateAll(), Creature::RegenerateHealth(), Player::RegenerateHealth(), and Creature::Update().

◆ isPossessed()

◆ isPossessedByPlayer()

bool Unit::isPossessedByPlayer ( ) const
inline

◆ isPossessing() [1/2]

bool Unit::isPossessing ( ) const
inline
1303 {
1304 if (Unit* u = GetCharm())
1305 return u->isPossessed();
1306 else
1307 return false;
1308 }

References GetCharm().

Referenced by WorldSession::HandleCastSpellOpcode(), and misc_commandscript::HandleUnbindSightCommand().

◆ isPossessing() [2/2]

bool Unit::isPossessing ( Unit u) const
inline
1309{ return u->isPossessed() && GetCharmGUID() == u->GetGUID(); }
bool isPossessed() const
Definition Unit.h:1300

References GetCharmGUID(), Object::GetGUID(), and isPossessed().

◆ IsPvP()

◆ IsQuestGiver()

bool Unit::IsQuestGiver ( ) const
inline
@ UNIT_NPC_FLAG_QUESTGIVER
Definition UnitDefines.h:320

References HasNpcFlag(), and UNIT_NPC_FLAG_QUESTGIVER.

Referenced by npc_riggle_bassbait::npc_riggle_bassbaitAI::CheckTournamentState(), npc_lokhtos_darkbargainer::OnGossipHello(), npc_highlord_darion_mograine::OnGossipHello(), npc_augustus_the_touched::OnGossipHello(), npc_parqual_fintallas::OnGossipHello(), npc_varian_wrynn::OnGossipHello(), npc_thrall_bfu::OnGossipHello(), npc_cos_chromie_middle::OnGossipHello(), npcs_riverbreeze_and_silversky::OnGossipHello(), npc_thrall_warchief::OnGossipHello(), npc_braug_dimspirit::OnGossipHello(), npc_steward_of_time::OnGossipHello(), npc_stone_watcher_of_norgannon::OnGossipHello(), npc_rivern_frostwind::OnGossipHello(), npc_fos_leader::OnGossipHello(), npc_hor_leader::OnGossipHello(), npc_oculus_drakegiver::OnGossipHello(), npc_shandy_dalaran::OnGossipHello(), npc_razael_and_lyana::OnGossipHello(), npc_mcmanus::OnGossipHello(), npc_vekjik::OnGossipHello(), npc_avatar_of_freya::OnGossipHello(), npc_roxi_ramrocket::OnGossipHello(), npc_wg_demolisher_engineer::OnGossipHello(), npc_wg_spirit_guide::OnGossipHello(), npc_wg_queue::OnGossipHello(), npc_wg_quest_giver::OnGossipHello(), npc_finklestein::OnGossipHello(), npc_captain_saeed::OnGossipHello(), npc_innkeeper::OnGossipHello(), npc_prof_alchemy::OnGossipHello(), npc_prof_blacksmith::OnGossipHello(), npc_prof_leather::OnGossipHello(), npc_prof_tailor::OnGossipHello(), npc_taxi::OnGossipHello(), npc_riggle_bassbait::OnGossipHello(), and npc_sayge::OnGossipHello().

◆ IsRooted()

◆ IsScriptOverriden()

AuraEffect * Unit::IsScriptOverriden ( SpellInfo const *  spell,
int32  script 
) const
6058{
6060 for (AuraEffectList::const_iterator i = auras.begin(); i != auras.end(); ++i)
6061 {
6062 if ((*i)->GetMiscValue() == script)
6063 if ((*i)->IsAffectedOnSpell(spell))
6064 return (*i);
6065 }
6066 return nullptr;
6067}
@ SPELL_AURA_OVERRIDE_CLASS_SCRIPTS
Definition SpellAuraDefines.h:175

References GetAuraEffectsByType(), and SPELL_AURA_OVERRIDE_CLASS_SCRIPTS.

Referenced by Spell::CheckCast(), Spell::EffectWeaponDmg(), and AuraEffect::HandleAuraModShapeshift().

◆ IsServiceProvider()

bool Unit::IsServiceProvider ( ) const
inline

◆ IsSitState()

bool Unit::IsSitState ( ) const
13205{
13206 uint8 s = getStandState();
13207 return
13211}
@ UNIT_STAND_STATE_SIT_HIGH_CHAIR
Definition UnitDefines.h:38
@ UNIT_STAND_STATE_SIT_MEDIUM_CHAIR
Definition UnitDefines.h:37
@ UNIT_STAND_STATE_SIT_LOW_CHAIR
Definition UnitDefines.h:36
@ UNIT_STAND_STATE_SIT_CHAIR
Definition UnitDefines.h:34

References getStandState(), UNIT_STAND_STATE_SIT, UNIT_STAND_STATE_SIT_CHAIR, UNIT_STAND_STATE_SIT_HIGH_CHAIR, UNIT_STAND_STATE_SIT_LOW_CHAIR, and UNIT_STAND_STATE_SIT_MEDIUM_CHAIR.

Referenced by _ApplyAura(), AttackerStateUpdate(), IsStandState(), Spell::prepare(), and SpellTakenCritChance().

◆ isSpellBlocked()

bool Unit::isSpellBlocked ( Unit victim,
SpellInfo const *  spellProto,
WeaponAttackType  attackType = BASE_ATTACK 
)
3231{
3232 // These spells can't be blocked
3233 if (spellProto && spellProto->HasAttribute(SPELL_ATTR0_NO_ACTIVE_DEFENSE))
3234 return false;
3235
3236 if (victim->HasIgnoreHitDirectionAura() || victim->HasInArc(M_PI, this))
3237 {
3238 // Check creatures flags_extra for disable block
3239 if (victim->IsCreature() &&
3241 return false;
3242
3243 float blockChance = victim->GetUnitBlockChance();
3244 blockChance += (int32(GetWeaponSkillValue(attackType)) - int32(victim->GetMaxSkillValueForLevel())) * 0.04f;
3245
3246 // xinef: cant block while casting or while stunned
3247 if (blockChance < 0.0f || victim->IsNonMeleeSpellCast(false, false, true) || victim->HasUnitState(UNIT_STATE_CONTROLLED))
3248 blockChance = 0.0f;
3249
3250 if (roll_chance_f(blockChance))
3251 return true;
3252 }
3253 return false;
3254}
@ CREATURE_FLAG_EXTRA_NO_BLOCK
Definition CreatureData.h:49
@ SPELL_ATTR0_NO_ACTIVE_DEFENSE
Definition SharedDefines.h:414
@ UNIT_STATE_CONTROLLED
Definition UnitDefines.h:215
bool HasIgnoreHitDirectionAura() const
Definition Unit.h:1796
uint32 GetWeaponSkillValue(WeaponAttackType attType, Unit const *target=nullptr) const
Definition Unit.cpp:3907
float GetUnitBlockChance() const
Definition Unit.cpp:3823

References CREATURE_FLAG_EXTRA_NO_BLOCK, GetMaxSkillValueForLevel(), GetUnitBlockChance(), GetWeaponSkillValue(), SpellInfo::HasAttribute(), Creature::HasFlagsExtra(), HasIgnoreHitDirectionAura(), Position::HasInArc(), HasUnitState(), Object::IsCreature(), IsNonMeleeSpellCast(), roll_chance_f(), SPELL_ATTR0_NO_ACTIVE_DEFENSE, Object::ToCreature(), and UNIT_STATE_CONTROLLED.

Referenced by CalculateSpellDamageTaken().

◆ IsSpiritGuide()

bool Unit::IsSpiritGuide ( ) const
inline

◆ IsSpiritHealer()

bool Unit::IsSpiritHealer ( ) const
inline

◆ IsSpiritService()

◆ IsStandState()

◆ IsStandUpOnMovementState()

◆ IsStopped()

bool Unit::IsStopped ( ) const
inline
1746{ return !(HasUnitState(UNIT_STATE_MOVING)); }
@ UNIT_STATE_MOVING
Definition UnitDefines.h:214

References HasUnitState(), and UNIT_STATE_MOVING.

Referenced by RotateMovementGenerator::Initialize(), IdleMovementGenerator::Reset(), and SetFacingToObject().

◆ IsSummon()

bool Unit::IsSummon ( ) const
inline
@ UNIT_MASK_SUMMON
Definition UnitDefines.h:156

References m_unitTypeMask, and UNIT_MASK_SUMMON.

Referenced by Creature::CanPeriodicallyCallForAssistance(), spell_item_unsated_craving::CheckProc(), npc_tiger_matriarch::npc_tiger_matriarchAI::DamageTaken(), Spell::EffectScriptEffect(), boss_skeram::EnterEvadeMode(), npc_phantom_hallucination::npc_phantom_hallucinationAI::EnterEvadeMode(), npc_marzon_silent_blade::npc_marzon_silent_bladeAI::EnterEvadeMode(), SuckBackEvent::Execute(), Spell::finish(), GetAllMinionsByEntry(), SmartScript::GetTargets(), WorldSession::HandleDismissCritter(), spell_pri_lightwell::HandleScriptEffect(), TempSummon::InitStats(), SpellClickInfo::IsFitToRequirements(), boss_skeram::JustDied(), boss_tyrannus::boss_tyrannusAI::JustDied(), boss_freya_iron_root::JustDied(), boss_yoggsaron_influence_tentacle::JustDied(), boss_essence_of_anger::boss_essence_of_angerAI::JustDied(), npc_pet_dk_ghoul::JustDied(), boss_skeram::JustEngagedWith(), npc_marzon_silent_blade::npc_marzon_silent_bladeAI::JustEngagedWith(), npc_tiger_matriarch::npc_tiger_matriarchAI::KilledUnit(), npc_marzon_silent_blade::npc_marzon_silent_bladeAI::MovementInform(), npc_attracted_reef_bull::npc_attracted_reef_bullAI::MovementInform(), npc_attracted_reef_bull::npc_attracted_reef_bullAI::npc_attracted_reef_bullAI(), npc_batrider::npc_batrider(), BattlefieldWG::OnCreatureCreate(), InstanceScript::OnCreatureCreate(), instance_blackfathom_deeps::instance_blackfathom_deeps_InstanceMapScript::OnCreatureCreate(), instance_hyjal::instance_mount_hyjal_InstanceMapScript::OnCreatureCreate(), npc_wormhole::OnGossipHello(), instance_blackfathom_deeps::instance_blackfathom_deeps_InstanceMapScript::OnUnitDeath(), RemoveAllControlled(), RemoveAllMinionsByEntry(), npc_stormforged_lieutenant::Reset(), npc_plaguehound_tracker::npc_plaguehound_trackerAI::Reset(), Creature::SaveRespawnTime(), Creature::SearchFormation(), Spell::SelectImplicitCasterObjectTargets(), Creature::SelectVictim(), npc_ulduar_flames_spread::SpellHit(), ToTempSummon(), ToTempSummon(), npc_valkyr_battle_maiden::npc_valkyr_battle_maidenAI::UpdateAI(), boss_skeram::UpdateAI(), npc_oculus_drake::npc_oculus_drakeAI::UpdateAI(), npc_ulduar_flash_freeze::UpdateAI(), npc_vh_void_sentry::npc_vh_void_sentryAI::UpdateAI(), and Player::VehicleSpellInitialize().

◆ isSwimming()

◆ IsTabardDesigner()

bool Unit::IsTabardDesigner ( ) const
inline

◆ isTargetableForAttack()

◆ IsTaxi()

bool Unit::IsTaxi ( ) const
inline

◆ IsTotem()

◆ IsTrainer()

◆ isTurning()

bool Unit::isTurning ( ) const
inline

◆ IsUnderLastManaUseEffect()

bool Unit::IsUnderLastManaUseEffect ( ) const

◆ IsUnderWater()

bool Unit::IsUnderWater ( ) const
virtual
4497{
4499}
@ LIQUID_MAP_UNDER_WATER
Definition GridTerrainData.h:195

References WorldObject::GetLiquidData(), LIQUID_MAP_UNDER_WATER, and LiquidData::Status.

Referenced by Creature::setDeathState().

◆ IsValidAssistTarget()

bool Unit::IsValidAssistTarget ( Unit const *  target) const
10943{
10944 return _IsValidAssistTarget(target, nullptr);
10945}
bool _IsValidAssistTarget(Unit const *target, SpellInfo const *bySpell) const
Definition Unit.cpp:10948

References _IsValidAssistTarget().

Referenced by SmartAI::AssistPlayerInCombatAgainst().

◆ IsValidAttackTarget()

bool Unit::IsValidAttackTarget ( Unit const *  target,
SpellInfo const *  bySpell = nullptr 
) const
10805{
10806 return _IsValidAttackTarget(target, bySpell);
10807}

References _IsValidAttackTarget().

Referenced by npc_escortAI::AssistPlayerInCombatAgainst(), Creature::CanCreatureAttack(), spell_pal_holy_shock::CheckCast(), spell_pri_penance::CheckCast(), CreatureGroup::GetNewTargetForMember(), WorldSession::HandleAttackSwingOpcode(), spell_teron_gorefiend_shadowy_construct::HandleEffectApply(), npc_pet_dk_army_of_the_dead::IsSummonedBy(), CreatureGroup::MemberEngagingTarget(), npc_icc_vengeful_fleshreaper::npc_icc_vengeful_fleshreaperAI::MoveInLineOfSight(), boss_doomwalker::MoveInLineOfSight(), boss_kaelthas::MoveInLineOfSight(), npc_air_force_bots::npc_air_force_botsAI::MoveInLineOfSight(), npc_pet_dk_ebon_gargoyle::MySelectNextTarget(), Acore::NearestAttackableNoTotemUnitInObjectRangeCheck::operator()(), Acore::NearestHostileUnitCheck::operator()(), MalleableGooSelector::operator()(), Acore::AnyUnfriendlyAttackableVisibleUnitInObjectRangeCheck::operator()(), SelectNearbyNoTotemTarget(), SelectNearbyTarget(), CreatureAI::SetGazeOn(), StopAttackingInvalidTarget(), SimpleCharmedAI::UpdateAI(), npc_anubarak_spike::npc_anubarak_spikeAI::UpdateAI(), npc_high_overlord_saurfang_igb::npc_high_overlord_saurfang_igbAI::UpdateAI(), npc_muradin_bronzebeard_igb::npc_muradin_bronzebeard_igbAI::UpdateAI(), npc_gunship_boarding_addAI::UpdateAI(), npc_gunship_gunner::npc_gunship_gunnerAI::UpdateAI(), npc_putricide_oozeAI::UpdateAI(), npc_icc_ice_sphere::npc_icc_ice_sphereAI::UpdateAI(), npc_valkyr_shadowguard::npc_valkyr_shadowguardAI::UpdateAI(), boss_four_horsemen::boss_four_horsemenAI::UpdateAI(), PossessedAI::UpdateAI(), Player::UpdateCharmedAI(), Player::UpdateFFAPvPFlag(), and Player::UpdateFFAPvPState().

◆ IsVehicle()

bool Unit::IsVehicle ( ) const
inline

References m_unitTypeMask, and UNIT_MASK_VEHICLE.

Referenced by Battleground::AddCreature(), Creature::AddToWorld(), ApplyResilience(), CanHaveThreatList(), spell_wintergrasp_water::CheckCast(), Spell::CheckEffectTarget(), SpellInfo::CheckTarget(), Map::CreatureRelocation(), DealDamage(), DealMeleeDamage(), MotionTransport::DelayedTeleportTransport(), Spell::EffectDummy(), Spell::EffectKnockBack(), Spell::EffectSummonType(), CreatureAI::EnterEvadeMode(), SmartScript::GetTargets(), GetVelocity(), AuraEffect::HandleAuraControlVehicle(), debug_commandscript::HandleDebugEnterVehicleCommand(), debug_commandscript::HandleDebugSetVehicleIdCommand(), spell_q13280_13283_plant_battle_standard::HandleDummy(), BattlefieldWG::HandleKill(), BattlegroundIC::HandleKillUnit(), WorldSession::HandlePetActionHelper(), spell_q12919_gymers_throw::HandleScript(), spell_putricide_mutated_transformation::HandleSummon(), TempSummon::InitStats(), KillRewarder::KillRewarder(), spell_igb_overheat_aura::Load(), MagicSpellHitResult(), npc_brann_radio::MoveInLineOfSight(), BattlefieldWG::OnUnitDeath(), OutDebugInfo(), VehicleAI::Permissible(), Map::PlayerRelocation(), SmartScript::ProcessAction(), RemoveCharmedBy(), RemoveFromWorld(), Spell::SelectImplicitCasterObjectTargets(), SetCharmedBy(), SetOwnerGUID(), SetSpeed(), Player::StopCastingCharm(), Map::SummonCreature(), UpdateCharmAI(), Creature::UpdateEntry(), UpdateHeight(), UpdateOrientation(), and UpdateSpeed().

◆ IsVendor()

◆ IsVisible()

bool Unit::IsVisible ( ) const
inline
@ SEC_PLAYER
Definition Common.h:57
@ SERVERSIDE_VISIBILITY_GM
Definition SharedDefines.h:1284
T_VALUES GetValue(FLAG_TYPE flag) const
Definition Object.h:393

References FlaggedValuesArray32< T_VALUES, T_FLAGS, FLAG_TYPE, ARRAY_SIZE >::GetValue(), WorldObject::m_serverSideVisibility, SEC_PLAYER, and SERVERSIDE_VISIBILITY_GM.

Referenced by npc_ghostly_priest::npc_ghostly_priestAI::AttackStart(), npc_phantom_mage::npc_phantom_mageAI::AttackStart(), npc_shadowy_mercenary::npc_shadowy_mercenaryAI::AttackStart(), npc_spectral_footman::npc_spectral_footmanAI::AttackStart(), npc_tortured_rifleman::npc_tortured_riflemanAI::AttackStart(), boss_blood_queen_lana_thel::boss_blood_queen_lana_thelAI::CanAIAttack(), boss_professor_putricide::boss_professor_putricideAI::CanAIAttack(), boss_sindragosa::boss_sindragosaAI::CanAIAttack(), boss_the_lich_king::boss_the_lich_kingAI::CanAIAttack(), SpellInfo::CheckTarget(), AuraEffect::HandlePhase(), Player::IsVisibleGloballyFor(), boss_the_lich_king::boss_the_lich_kingAI::JustEngagedWith(), boss_blood_queen_lana_thel::boss_blood_queen_lana_thelAI::JustEngagedWith(), boss_professor_putricide::boss_professor_putricideAI::JustEngagedWith(), boss_sindragosa::boss_sindragosaAI::JustEngagedWith(), Acore::AllFriendlyCreaturesInGrid::operator()(), boss_sapphiron::boss_sapphironAI::Reset(), npc_pos_leader::npc_pos_leaderAI::SetData(), npc_ravenclaw_apparition::npc_ravenclaw_apparitionAI::UpdateAI(), npc_murkdeep::npc_murkdeepAI::UpdateAI(), npc_big_ooze::npc_big_oozeAI::UpdateAI(), and boss_vazruden_the_herald::UpdateAI().

◆ IsWalking()

◆ IsWithinBoundaryRadius()

bool Unit::IsWithinBoundaryRadius ( const Unit obj) const
813{
814 if (!obj || !IsInMap(obj) || !InSamePhase(obj))
815 return false;
816
817 float objBoundaryRadius = std::max(obj->GetBoundaryRadius(), MIN_MELEE_REACH);
818
819 return IsInDist(obj, objBoundaryRadius);
820}
float GetBoundaryRadius() const
Definition Unit.h:870
bool IsInDist(float x, float y, float z, float dist) const
Definition Position.h:221

References GetBoundaryRadius(), WorldObject::InSamePhase(), Position::IsInDist(), WorldObject::IsInMap(), and MIN_MELEE_REACH.

Referenced by Spell::CheckRange(), Acore::WorldObjectSpellConeTargetCheck::operator()(), and Player::Update().

◆ IsWithinCombatRange()

bool Unit::IsWithinCombatRange ( Unit const *  obj,
float  dist2compare 
) const
758{
759 if (!obj || !IsInMap(obj) || !InSamePhase(obj))
760 return false;
761
762 float dx = GetPositionX() - obj->GetPositionX();
763 float dy = GetPositionY() - obj->GetPositionY();
764 float dz = GetPositionZ() - obj->GetPositionZ();
765 float distsq = dx * dx + dy * dy + dz * dz;
766
767 float sizefactor = GetCombatReach() + obj->GetCombatReach();
768 float maxdist = dist2compare + sizefactor;
769
770 return distsq < maxdist * maxdist;
771}

References GetCombatReach(), Position::GetPositionX(), Position::GetPositionY(), Position::GetPositionZ(), WorldObject::InSamePhase(), and WorldObject::IsInMap().

Referenced by ArcherAI::AttackStart(), TurretAI::CanAIAttack(), Spell::CheckRange(), UnitAI::DoSpellAttackIfReady(), UnitAI::DoSpellAttackToRandomTargetIfReady(), spell_nightbane_fireball_barrage::FilterTargets(), SmartScript::GetTargets(), npc_underbat::JustEngagedWith(), DefaultTargetSelector::operator()(), SpellTargetSelector::operator()(), PowerUsersSelector::operator()(), MalleableGooSelector::operator()(), ArcherAI::UpdateAI(), boss_flame_leviathan::UpdateAI(), and HostileReference::updateOnlineStatus().

◆ IsWithinMeleeRange()

bool Unit::IsWithinMeleeRange ( Unit const *  obj,
float  dist = 0.f 
) const
774{
775 if (!obj || !IsInMap(obj) || !InSamePhase(obj))
776 return false;
777
778 float dx = GetPositionX() - obj->GetPositionX();
779 float dy = GetPositionY() - obj->GetPositionY();
780 float dz = GetPositionZ() - obj->GetPositionZ();
781 float distsq = dx * dx + dy * dy + dz * dz;
782
783 float maxdist = dist + GetMeleeRange(obj);
784
785 if ((IsPlayer() || obj->IsPlayer()) && HasLeewayMovement() && obj->HasLeewayMovement())
786 maxdist += LEEWAY_BONUS_RANGE;
787
788 return distsq < maxdist * maxdist;
789}
#define LEEWAY_BONUS_RANGE
Definition ObjectDefines.h:51
bool HasLeewayMovement() const
Definition Unit.h:1713

References GetMeleeRange(), Position::GetPositionX(), Position::GetPositionY(), Position::GetPositionZ(), HasLeewayMovement(), WorldObject::InSamePhase(), WorldObject::IsInMap(), Object::IsPlayer(), and LEEWAY_BONUS_RANGE.

Referenced by boss_marli::_chargePlayer(), boss_swamplord_muselek::AttackStart(), SmartAI::AttackStart(), boss_ragnaros::boss_ragnarosAI::CanAIAttack(), boss_ouro::CanAIAttack(), boss_alar::CanAIAttack(), PetAI::CanAttack(), Spell::CheckRange(), SmartAI::DistanceYourself(), UnitAI::DoMeleeAttackIfReady(), boss_mandokir::boss_mandokirAI::DoMeleeAttackIfReady(), boss_ambassador_hellmaw::DoMeleeAttackIfReady(), ChaseMovementGenerator< T >::DoUpdate(), spell_shazzrah_gate_dummy::FilterTargets(), boss_supremus::FindHatefulStrikeTarget(), boss_thaddius::boss_thaddiusAI::IsAnyPlayerInMeleeRange(), boss_ouro::IsPlayerWithinMeleeRange(), ThreatContainer::IsPreferredTarget(), boss_ragnaros::boss_ragnarosAI::IsVictimWithinMeleeRange(), npc_overlord_drakuru_betrayal::JustEngagedWith(), boss_swamplord_muselek::JustEngagedWith(), boss_vem::JustEngagedWith(), CreatureAI::MoveCircleChecks(), boss_twin_valkyrAI::myDoMeleeAttackIfReady(), SpellTargetSelector::operator()(), MysticBuffetTargetFilter::operator()(), SmartScript::ProcessEvent(), ThreatContainer::SelectNextVictim(), boss_murmur::ShouldCastResonance(), boss_quartermaster_zigris::SpellHitTarget(), Player::Update(), boss_quartermaster_zigris::UpdateAI(), npc_bh_thalorien_dawnseeker::npc_bh_thalorien_dawnseekerAI::UpdateAI(), boss_mandokir::boss_mandokirAI::UpdateAI(), boss_skeram::UpdateAI(), npc_weegli_blastfuse::npc_weegli_blastfuseAI::UpdateAI(), npc_snobold_vassal::npc_snobold_vassalAI::UpdateAI(), boss_bronjahm::boss_bronjahmAI::UpdateAI(), boss_marwyn::boss_marwynAI::UpdateAI(), npc_hor_lumbering_abomination::npc_hor_lumbering_abominationAI::UpdateAI(), boss_tyrannus::boss_tyrannusAI::UpdateAI(), npc_high_overlord_saurfang_igb::npc_high_overlord_saurfang_igbAI::UpdateAI(), npc_muradin_bronzebeard_igb::npc_muradin_bronzebeard_igbAI::UpdateAI(), npc_darnavan::npc_darnavanAI::UpdateAI(), boss_lord_marrowgar::UpdateAI(), boss_sindragosa::boss_sindragosaAI::UpdateAI(), boss_the_lich_king::boss_the_lich_kingAI::UpdateAI(), npc_blazing_skeleton::npc_blazing_skeletonAI::UpdateAI(), boss_gluth::boss_gluthAI::UpdateAI(), boss_patchwerk::boss_patchwerkAI::UpdateAI(), boss_kologarn::UpdateAI(), boss_razorscale::UpdateAI(), npc_ulduar_dark_rune_guardian::UpdateAI(), npc_ulduar_dark_rune_sentinel::UpdateAI(), boss_skarvald_the_constructor::UpdateAI(), boss_lady_vashj::UpdateAI(), boss_the_lurker_below::UpdateAI(), boss_omor_the_unscarred::UpdateAI(), PetAI::UpdateAI(), npc_dark_fiend::UpdateAI(), npc_zuljin_vortex::UpdateAI(), npc_suppresser::npc_suppresserAI::UpdateAI(), and boss_yoggsaron_crusher_tentacle::UpdateAI().

◆ IsWithinRange()

bool Unit::IsWithinRange ( Unit const *  obj,
float  dist 
) const
798{
799 if (!obj || !IsInMap(obj) || !InSamePhase(obj))
800 {
801 return false;
802 }
803
804 auto dx = GetPositionX() - obj->GetPositionX();
805 auto dy = GetPositionY() - obj->GetPositionY();
806 auto dz = GetPositionZ() - obj->GetPositionZ();
807 auto distsq = dx * dx + dy * dy + dz * dz;
808
809 return distsq <= dist * dist;
810}

References Position::GetPositionX(), Position::GetPositionY(), Position::GetPositionZ(), WorldObject::InSamePhase(), and WorldObject::IsInMap().

Referenced by boss_swamplord_muselek::CanShootVictim(), npc_sunblade_scout::JustEngagedWith(), and npc_amanishi_scout::JustEngagedWith().

◆ JumpTo() [1/2]

void Unit::JumpTo ( float  speedXY,
float  speedZ,
bool  forward = true 
)
15622{
15623 float angle = forward ? 0 : M_PI;
15624 if (IsCreature())
15625 GetMotionMaster()->MoveJumpTo(angle, speedXY, speedZ);
15626 else
15627 {
15628 float vcos = cos(angle + GetOrientation());
15629 float vsin = std::sin(angle + GetOrientation());
15630
15631 WorldPacket data(SMSG_MOVE_KNOCK_BACK, (8 + 4 + 4 + 4 + 4 + 4));
15632 data << GetPackGUID();
15633 data << uint32(0); // Sequence
15634 data << float(vcos); // x direction
15635 data << float(vsin); // y direction
15636 data << float(speedXY); // Horizontal speed
15637 data << float(-speedZ); // Z Movement speed (vertical)
15638
15639 ToPlayer()->SendDirectMessage(&data);
15640 }
15641}
void MoveJumpTo(float angle, float speedXY, float speedZ)
The unit will jump in a specific direction.
Definition MotionMaster.cpp:636
void SendDirectMessage(WorldPacket const *data) const
Definition Player.cpp:5685
@ SMSG_MOVE_KNOCK_BACK
Definition Opcodes.h:269

References GetMotionMaster(), Position::GetOrientation(), Object::GetPackGUID(), Object::IsCreature(), MotionMaster::MoveJumpTo(), Player::SendDirectMessage(), SMSG_MOVE_KNOCK_BACK, and Object::ToPlayer().

Referenced by Spell::EffectLeapBack().

◆ JumpTo() [2/2]

void Unit::JumpTo ( WorldObject obj,
float  speedZ 
)
15644{
15645 float x, y, z;
15646 obj->GetContactPoint(this, x, y, z);
15647 float speedXY = GetExactDist2d(x, y) * 10.0f / speedZ;
15648 GetMotionMaster()->MoveJump(x, y, z, speedXY, speedZ);
15649}
void MoveJump(Position const &pos, float speedXY, float speedZ, uint32 id=0)
Definition MotionMaster.h:254
void GetContactPoint(WorldObject const *obj, float &x, float &y, float &z, float distance2d=CONTACT_DISTANCE) const
Definition Object.cpp:2779

References WorldObject::GetContactPoint(), Position::GetExactDist2d(), GetMotionMaster(), and MotionMaster::MoveJump().

◆ Kill()

void Unit::Kill ( Unit killer,
Unit victim,
bool  durabilityLoss = true,
WeaponAttackType  attackType = BASE_ATTACK,
SpellInfo const *  spellProto = nullptr,
Spell const *  spell = nullptr 
)
static
Todo:
: do instance binding anyway if the charmer/owner is offline
14078{
14079 // Prevent killing unit twice (and giving reward from kill twice)
14080 if (!victim->GetHealth())
14081 return;
14082
14083 if (killer && !killer->IsInMap(victim))
14084 killer = nullptr;
14085
14086 // find player: owner of controlled `this` or `this` itself maybe
14087 Player* player = killer ? killer->GetCharmerOrOwnerPlayerOrPlayerItself() : nullptr;
14088 Creature* creature = victim->ToCreature();
14089
14090 bool isRewardAllowed = true;
14091 if (creature)
14092 {
14093 isRewardAllowed = (creature->IsDamageEnoughForLootingAndReward() && !creature->IsLootRewardDisabled());
14094 if (!isRewardAllowed)
14095 creature->SetLootRecipient(nullptr);
14096 }
14097
14098 // pussywizard: remade this if section (player is on the same map
14099 if (isRewardAllowed && creature)
14100 {
14101 Player* lr = creature->GetLootRecipient();
14102 if (lr && lr->IsInMap(creature))
14103 player = creature->GetLootRecipient();
14104 else if (Group* lrg = creature->GetLootRecipientGroup())
14105 for (GroupReference* itr = lrg->GetFirstMember(); itr != nullptr; itr = itr->next())
14106 if (Player* member = itr->GetSource())
14107 if (member->IsAtLootRewardDistance(creature))
14108 {
14109 player = member;
14110 break;
14111 }
14112 }
14113
14114 // Exploit fix
14115 if (creature && creature->IsPet() && creature->GetOwnerGUID().IsPlayer())
14116 isRewardAllowed = false;
14117
14118 // Reward player, his pets, and group/raid members
14119 // call kill spell proc event (before real die and combat stop to triggering auras removed at death/combat stop)
14120 if (isRewardAllowed && player && player != victim)
14121 {
14122 WorldPacket data(SMSG_PARTYKILLLOG, (8 + 8)); // send event PARTY_KILL
14123 data << player->GetGUID(); // player with killing blow
14124 data << victim->GetGUID(); // victim
14125
14126 Player* looter = player;
14127 Group* group = player->GetGroup();
14128 bool hasLooterGuid = false;
14129
14130 if (group)
14131 {
14132 group->BroadcastPacket(&data, group->GetMemberGroup(player->GetGUID()));
14133
14134 if (creature)
14135 {
14136 group->UpdateLooterGuid(creature, true);
14137 if (group->GetLooterGuid() && group->GetLootMethod() != FREE_FOR_ALL)
14138 {
14139 looter = ObjectAccessor::FindPlayer(group->GetLooterGuid());
14140 if (looter)
14141 {
14142 hasLooterGuid = true;
14143 creature->SetLootRecipient(looter); // update creature loot recipient to the allowed looter.
14144 }
14145 }
14146 }
14147 }
14148 else
14149 {
14150 player->SendDirectMessage(&data);
14151
14152 if (creature)
14153 {
14154 WorldPacket data2(SMSG_LOOT_LIST, 8 + 1 + 1);
14155 data2 << creature->GetGUID();
14156 data2 << uint8(0); // unk1
14157 data2 << uint8(0); // no group looter
14158 player->SendMessageToSet(&data2, true);
14159 }
14160 }
14161
14162 // Generate loot before updating looter
14163 if (creature)
14164 {
14165 Loot* loot = &creature->loot;
14166 loot->clear();
14167
14168 if (uint32 lootid = creature->GetCreatureTemplate()->lootid)
14169 loot->FillLoot(lootid, LootTemplates_Creature, looter, false, false, creature->GetLootMode(), creature);
14170
14171 if (creature->GetLootMode())
14173
14174 if (group)
14175 {
14176 if (hasLooterGuid)
14177 group->SendLooter(creature, looter);
14178 else
14179 group->SendLooter(creature, nullptr);
14180
14181 // Update round robin looter only if the creature had loot
14182 if (!creature->loot.empty())
14183 group->UpdateLooterGuid(creature);
14184 }
14185 }
14186
14187 player->RewardPlayerAndGroupAtKill(victim, false);
14188 }
14189
14190 // Do KILL and KILLED procs. KILL proc is called only for the unit who landed the killing blow (and its owner - for pets and totems) regardless of who tapped the victim
14191 if (killer && (killer->IsPet() || killer->IsTotem()))
14192 if (Unit* owner = killer->GetOwner())
14193 {
14194 Unit::ProcSkillsAndAuras(owner, victim, PROC_FLAG_KILL, PROC_FLAG_NONE, PROC_EX_NONE, 0, attackType, spellProto, nullptr, -1, spell);
14195 sScriptMgr->OnPlayerCreatureKilledByPet( killer->GetCharmerOrOwnerPlayerOrPlayerItself(), victim->ToCreature());
14196 }
14197
14198 if (killer != victim)
14199 {
14200 Unit::ProcSkillsAndAuras(killer, victim, killer ? PROC_FLAG_KILL : 0, PROC_FLAG_KILLED, PROC_EX_NONE, 0, attackType, spellProto, nullptr, -1, spell);
14201 }
14202
14203 // Proc auras on death - must be before aura/combat remove
14204 Unit::ProcSkillsAndAuras(victim, nullptr, PROC_FLAG_DEATH, PROC_FLAG_NONE, PROC_EX_NONE, 0, attackType, spellProto, nullptr, -1, spell);
14205
14206 // update get killing blow achievements, must be done before setDeathState to be able to require auras on target
14207 // and before Spirit of Redemption as it also removes auras
14208 if (killer)
14209 if (Player* killerPlayer = killer->GetCharmerOrOwnerPlayerOrPlayerItself())
14210 killerPlayer->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_GET_KILLING_BLOWS, 1, 0, victim);
14211
14212 // Spirit of Redemption
14213 // if talent known but not triggered (check priest class for speedup check)
14214 bool spiritOfRedemption = false;
14216 {
14217 if (AuraEffect* aurEff = victim->GetAuraEffectDummy(20711))
14218 {
14219 // Xinef: aura_spirit_of_redemption is triggered by 27827 shapeshift
14220 if (victim->HasSpiritOfRedemptionAura() || victim->HasAura(27827))
14221 {
14222 /*LOG_INFO("misc", "Player ({}) died with spirit of redemption. Killer (Entry: {}, Name: {}), Map: {}, x: {}, y: {}, z: {}",
14223 victim->GetGUID().ToString(), killer ? killer->GetEntry() : 1, killer ? killer->GetName() : "", victim->GetMapId(), victim->GetPositionX(),
14224 victim->GetPositionY(), victim->GetPositionZ());
14225
14226 ACE_Stack_Trace trace(0, 50);
14227 LOG_INFO("misc", "TRACE: {}\n\n", trace);*/
14228 }
14229 else
14230 {
14231 // save value before aura remove
14232 uint32 ressSpellId = victim->GetUInt32Value(PLAYER_SELF_RES_SPELL);
14233 if (!ressSpellId)
14234 ressSpellId = victim->ToPlayer()->GetResurrectionSpellId();
14235
14236 //Remove all expected to remove at death auras (most important negative case like DoT or periodic triggers)
14237 victim->RemoveAllAurasOnDeath();
14238
14239 // Stop attacks
14240 victim->CombatStop();
14242
14243 // restore for use at real death
14244 victim->SetUInt32Value(PLAYER_SELF_RES_SPELL, ressSpellId);
14245
14246 // FORM_SPIRITOFREDEMPTION and related auras
14247 victim->CastSpell(victim, 27827, true, nullptr, aurEff);
14248 spiritOfRedemption = true;
14249 }
14250 }
14251 }
14252
14253 if (!spiritOfRedemption)
14254 {
14255 LOG_DEBUG("entities.unit", "SET DeathState::JustDied");
14257 }
14258
14259 // Inform pets (if any) when player kills target)
14260 // MUST come after victim->setDeathState(DeathState::JustDied); or pet next target
14261 // selection will get stuck on same target and break pet react state
14262 if (player)
14263 {
14264 Pet* pet = player->GetPet();
14265 if (pet && pet->IsAlive() && pet->isControlled())
14266 pet->AI()->KilledUnit(victim);
14267 }
14268
14269 // 10% durability loss on death
14270 // clean InHateListOf
14271 if (Player* plrVictim = victim->ToPlayer())
14272 {
14273 // remember victim PvP death for corpse type and corpse reclaim delay
14274 // at original death (not at SpiritOfRedemtionTalent timeout)
14275 plrVictim->SetPvPDeath(player != nullptr);
14276
14277 // only if not player and not controlled by player pet. And not at BG
14278 if ((durabilityLoss && !player && !plrVictim->InBattleground()) || (player && sWorld->getBoolConfig(CONFIG_DURABILITY_LOSS_IN_PVP)))
14279 {
14280 LOG_DEBUG("entities.unit", "We are dead, losing {} percent durability", sWorld->getRate(RATE_DURABILITY_LOSS_ON_DEATH) / 100.0f);
14281 plrVictim->DurabilityLossAll(sWorld->getRate(RATE_DURABILITY_LOSS_ON_DEATH) / 100.0f, false);
14282 // durability lost message
14283 plrVictim->SendDurabilityLoss();
14284 }
14285 // Call KilledUnit for creatures
14286 if (killer && killer->IsCreature() && killer->IsAIEnabled)
14287 killer->ToCreature()->AI()->KilledUnit(victim);
14288
14289 // last damage from non duel opponent or opponent controlled creature
14290 if (plrVictim->duel)
14291 {
14292 plrVictim->duel->Opponent->CombatStopWithPets(true);
14293 plrVictim->CombatStopWithPets(true);
14294 plrVictim->DuelComplete(DUEL_INTERRUPTED);
14295 }
14296 }
14297 else // creature died
14298 {
14299 LOG_DEBUG("entities.unit", "DealDamageNotPlayer");
14300
14301 if (!creature->IsPet() && creature->GetLootMode() > 0)
14302 {
14303 creature->GetThreatMgr().ClearAllThreat();
14304
14305 // must be after setDeathState which resets dynamic flags
14306 if (!creature->loot.isLooted())
14307 {
14309 }
14310 else
14311 {
14312 creature->AllLootRemovedFromCorpse();
14313 }
14314 }
14315
14316 // Call KilledUnit for creatures, this needs to be called after the lootable flag is set
14317 if (killer && killer->IsCreature() && killer->IsAIEnabled)
14318 killer->ToCreature()->AI()->KilledUnit(victim);
14319
14320 // Call creature just died function
14321 if (CreatureAI* ai = creature->AI())
14322 {
14323 ai->JustDied(killer);
14324 }
14325
14326 if (TempSummon* summon = creature->ToTempSummon())
14327 {
14328 if (WorldObject* summoner = summon->GetSummoner())
14329 {
14330 if (summoner->ToCreature() && summoner->ToCreature()->IsAIEnabled)
14331 {
14332 summoner->ToCreature()->AI()->SummonedCreatureDies(creature, killer);
14333 }
14334 else if (summoner->ToGameObject() && summoner->ToGameObject()->AI())
14335 {
14336 summoner->ToGameObject()->AI()->SummonedCreatureDies(creature, killer);
14337 }
14338 }
14339 }
14340
14341 // Dungeon specific stuff, only applies to players killing creatures
14342 if (creature->GetInstanceId())
14343 {
14344 Map* instanceMap = creature->GetMap();
14345 //Player* creditedPlayer = GetCharmerOrOwnerPlayerOrPlayerItself();
14347
14348 if (instanceMap->IsDungeon() && player)
14349 if (instanceMap->IsRaidOrHeroicDungeon())
14351 instanceMap->ToInstanceMap()->PermBindAllPlayers();
14352 }
14353 }
14354
14355 // outdoor pvp things, do these after setting the death state, else the player activity notify won't work... doh...
14356 // handle player kill only if not suicide (spirit of redemption for example)
14357 if (player && killer != victim)
14358 {
14359 if (OutdoorPvP* pvp = player->GetOutdoorPvP())
14360 pvp->HandleKill(player, victim);
14361
14362 if (Battlefield* bf = sBattlefieldMgr->GetBattlefieldToZoneId(player->GetZoneId()))
14363 bf->HandleKill(player, victim);
14364 }
14365
14366 //if (victim->IsPlayer())
14367 // if (OutdoorPvP* pvp = victim->ToPlayer()->GetOutdoorPvP())
14368 // pvp->HandlePlayerActivityChangedpVictim->ToPlayer();
14369
14370 // battleground things (do this at the end, so the death state flag will be properly set to handle in the bg->handlekill)
14371 if (player)
14372 if (Battleground* bg = player->GetBattleground())
14373 {
14374 if (victim->IsPlayer())
14375 bg->HandleKillPlayer(victim->ToPlayer(), player);
14376 else
14377 bg->HandleKillUnit(victim->ToCreature(), player);
14378 }
14379
14380 // achievement stuff
14381 if (killer && victim->IsPlayer())
14382 {
14383 if (killer->IsCreature())
14385 else if (victim != killer && killer->IsPlayer())
14387 }
14388
14389 // Hook for OnPVPKill Event
14390 if (killer)
14391 {
14392 if (Player* killerPlr = killer->ToPlayer())
14393 {
14394 if (Player* killedPlr = victim->ToPlayer())
14395 sScriptMgr->OnPlayerPVPKill(killerPlr, killedPlr);
14396 else if (Creature* killedCre = victim->ToCreature())
14397 sScriptMgr->OnPlayerCreatureKill(killerPlr, killedCre);
14398 }
14399 else if (Creature* killerCre = killer->ToCreature())
14400 {
14401 if (Player* killed = victim->ToPlayer())
14402 sScriptMgr->OnPlayerKilledByCreature(killerCre, killed);
14403 }
14404 }
14405
14406 sScriptMgr->OnUnitDeath(victim, killer);
14407}
#define sBattlefieldMgr
Definition BattlefieldMgr.h:77
@ CREATURE_FLAG_EXTRA_INSTANCE_BIND
Definition CreatureData.h:45
@ ACHIEVEMENT_CRITERIA_TYPE_KILLED_BY_PLAYER
Definition DBCEnums.h:138
@ ACHIEVEMENT_CRITERIA_TYPE_KILLED_BY_CREATURE
Definition DBCEnums.h:137
@ ACHIEVEMENT_CRITERIA_TYPE_GET_KILLING_BLOWS
Definition DBCEnums.h:170
LootStore LootTemplates_Creature("creature_loot_template", "creature entry", true)
@ FREE_FOR_ALL
Definition LootMgr.h:58
@ PLAYER_FLAGS_IS_OUT_OF_BOUNDS
Definition Player.h:473
@ UNIT_DYNFLAG_LOOTABLE
Definition SharedDefines.h:3361
@ DUEL_INTERRUPTED
Definition SharedDefines.h:3868
@ CLASS_PRIEST
Definition SharedDefines.h:145
@ PROC_EX_NONE
Definition SpellMgr.h:195
@ PROC_FLAG_KILLED
Definition SpellMgr.h:107
@ PROC_FLAG_DEATH
Definition SpellMgr.h:143
@ PROC_FLAG_KILL
Definition SpellMgr.h:108
@ PLAYER_SELF_RES_SPELL
Definition UpdateFields.h:370
@ RATE_DURABILITY_LOSS_ON_DEATH
Definition WorldConfig.h:481
@ CONFIG_DURABILITY_LOSS_IN_PVP
Definition WorldConfig.h:25
Definition Battlefield.h:205
Definition CreatureAI.h:71
virtual void KilledUnit(Unit *)
Definition CreatureAI.h:132
Loot loot
Definition Creature.h:228
uint16 GetLootMode() const
Definition Creature.h:242
void AllLootRemovedFromCorpse()
Definition Creature.cpp:2954
bool IsLootRewardDisabled() const
Definition Creature.h:364
Player * GetLootRecipient() const
Definition Creature.cpp:1267
bool IsDamageEnoughForLootingAndReward() const
Definition Creature.cpp:3675
Group * GetLootRecipientGroup() const
Definition Creature.cpp:1274
GroupReference * next()
Definition GroupReference.h:36
void BroadcastPacket(WorldPacket const *packet, bool ignorePlayersInBGRaid, int group=-1, ObjectGuid ignore=ObjectGuid::Empty)
Definition Group.cpp:1757
uint8 GetMemberGroup(ObjectGuid guid) const
Definition Group.cpp:2394
ObjectGuid GetLooterGuid() const
Definition Group.cpp:2331
LootMethod GetLootMethod() const
Definition Group.cpp:2326
void UpdateLooterGuid(WorldObject *pLootedObject, bool ifneed=false)
Definition Group.cpp:1868
void SendLooter(Creature *creature, Player *pLooter)
Definition Group.cpp:967
void PermBindAllPlayers()
Definition Map.cpp:2195
Definition Map.h:163
bool IsRaidOrHeroicDungeon() const
Definition Map.h:298
InstanceMap * ToInstanceMap()
Definition Map.h:378
virtual void SetDynamicFlag(uint32 flag)
Definition Object.h:124
Definition OutdoorPvP.h:186
TeamId GetTeamId(bool original=false) const
Definition Player.h:2125
Battleground * GetBattleground(bool create=false) const
Definition Player.cpp:12175
uint32 GetResurrectionSpellId()
Definition Player.cpp:12605
OutdoorPvP * GetOutdoorPvP() const
Definition Player.cpp:12506
void RewardPlayerAndGroupAtKill(Unit *victim, bool isBattleGround)
Definition Player.cpp:12719
void RemoveAllAurasOnDeath()
Definition Unit.cpp:5574
AuraEffect * GetAuraEffectDummy(uint32 spellid) const
Definition Unit.cpp:5775
uint32 GetInstanceId() const
Definition Object.h:509
uint32 GetZoneId() const
Definition Object.cpp:3082
@ SMSG_PARTYKILLLOG
Definition Opcodes.h:531
@ SMSG_LOOT_LIST
Definition Opcodes.h:1047
Player * FindPlayer(ObjectGuid const guid)
Definition ObjectAccessor.cpp:245
uint32 mingold
Definition CreatureData.h:227
uint32 maxgold
Definition CreatureData.h:228
uint32 lootid
Definition CreatureData.h:220
Definition LootMgr.h:313
bool empty() const
Definition LootMgr.h:367
bool isLooted() const
Definition LootMgr.h:368
void clear()
Definition LootMgr.h:343
void generateMoneyLoot(uint32 minAmount, uint32 maxAmount)
Definition LootMgr.cpp:838
bool FillLoot(uint32 lootId, LootStore const &store, Player *lootOwner, bool personal, bool noEmptyError=false, uint16 lootMode=LOOT_MODE_DEFAULT, WorldObject *lootSource=nullptr)
Definition LootMgr.cpp:571

References ACHIEVEMENT_CRITERIA_TYPE_GET_KILLING_BLOWS, ACHIEVEMENT_CRITERIA_TYPE_KILLED_BY_CREATURE, ACHIEVEMENT_CRITERIA_TYPE_KILLED_BY_PLAYER, Creature::AI(), Creature::AllLootRemovedFromCorpse(), Group::BroadcastPacket(), CastSpell(), CLASS_CONTEXT_ABILITY, CLASS_PRIEST, Loot::clear(), ThreatMgr::ClearAllThreat(), CombatStop(), CONFIG_DURABILITY_LOSS_IN_PVP, CREATURE_FLAG_EXTRA_INSTANCE_BIND, HostileRefMgr::deleteReferences(), DUEL_INTERRUPTED, Loot::empty(), Loot::FillLoot(), ObjectAccessor::FindPlayer(), FREE_FOR_ALL, Loot::generateMoneyLoot(), GetAuraEffectDummy(), Player::GetBattleground(), GetCharmerOrOwnerPlayerOrPlayerItself(), Creature::GetCreatureTemplate(), Object::GetEntry(), Player::GetGroup(), Object::GetGUID(), GetHealth(), getHostileRefMgr(), WorldObject::GetInstanceId(), Group::GetLooterGuid(), Group::GetLootMethod(), Creature::GetLootMode(), Creature::GetLootRecipient(), Creature::GetLootRecipientGroup(), WorldObject::GetMap(), Group::GetMemberGroup(), Player::GetOutdoorPvP(), GetOwner(), GetOwnerGUID(), Player::GetPet(), Player::GetResurrectionSpellId(), Player::GetTeamId(), GetThreatMgr(), Object::GetUInt32Value(), WorldObject::GetZoneId(), HasAura(), Creature::HasFlagsExtra(), Player::HasPlayerFlag(), HasSpiritOfRedemptionAura(), Player::InBattleground(), IsAIEnabled, IsAlive(), IsClass(), Pet::isControlled(), Object::IsCreature(), Creature::IsDamageEnoughForLootingAndReward(), Map::IsDungeon(), WorldObject::IsInMap(), Loot::isLooted(), Creature::IsLootRewardDisabled(), IsPet(), Object::IsPlayer(), ObjectGuid::IsPlayer(), Map::IsRaidOrHeroicDungeon(), IsTotem(), JustDied, CreatureAI::KilledUnit(), LOG_DEBUG, Creature::loot, CreatureTemplate::lootid, LootTemplates_Creature, CreatureTemplate::maxgold, CreatureTemplate::mingold, GroupReference::next(), InstanceMap::PermBindAllPlayers(), PLAYER_FLAGS_IS_OUT_OF_BOUNDS, PLAYER_SELF_RES_SPELL, PROC_EX_NONE, PROC_FLAG_DEATH, PROC_FLAG_KILL, PROC_FLAG_KILLED, PROC_FLAG_NONE, ProcSkillsAndAuras(), RATE_DURABILITY_LOSS_ON_DEATH, RemoveAllAurasOnDeath(), Player::RewardPlayerAndGroupAtKill(), sBattlefieldMgr, Player::SendDirectMessage(), Group::SendLooter(), Player::SendMessageToSet(), setDeathState(), Object::SetDynamicFlag(), Creature::SetLootRecipient(), SetUInt32Value(), SMSG_LOOT_LIST, SMSG_PARTYKILLLOG, sScriptMgr, sWorld, Object::ToCreature(), Map::ToInstanceMap(), Object::ToPlayer(), ToTempSummon(), UNIT_DYNFLAG_LOOTABLE, Player::UpdateAchievementCriteria(), and Group::UpdateLooterGuid().

Referenced by boss_headless_horseman_head::DamageTaken(), boss_viscidus::DamageTaken(), npc_ulduar_iron_construct::DamageTaken(), boss_yoggsaron_brain::DamageTaken(), DealDamage(), boss_jedoga_shadowseeker::DoAction(), npc_pos_martin_or_gorkun_second::npc_pos_martin_or_gorkun_secondAI::DoAction(), boss_illidan_stormrage::DoAction(), boss_illidari_council::DoAction(), boss_blood_queen_lana_thel::boss_blood_queen_lana_thelAI::EnterEvadeMode(), LichKingDeathEvent::Execute(), DeathEvent::Execute(), BattlegroundIC::HandleCapturedNodes(), misc_commandscript::HandleDieCommand(), spell_ooze_zap_channel_end::HandleDummy(), spell_pos_rimefang_frost_nova::HandleDummy(), spell_q12589_shoot_rjr::HandleDummy(), spell_item_chicken_cover::HandleDummy(), spell_yogg_saron_titanic_storm::HandleDummyEffect(), spell_item_rocket_chicken::HandleDummyTick(), spell_ulduar_arachnopod_damaged_aura::HandleEffectPeriodic(), spell_mc_play_dead_aura::HandleEffectRemove(), spell_teron_gorefiend_spiritual_vengeance::HandleEffectRemove(), spell_chapter2_persuasive_strike::HandleHit(), spell_voa_overcharge_aura::HandlePeriodicDummy(), AuraEffect::HandlePeriodicTriggerSpellAuraTick(), spell_felmyst_fog_of_corruption_charm_aura::HandleRemove(), spell_leotheras_clear_consuming_madness::HandleScriptEffect(), boss_twin_valkyrAI::JustDied(), boss_prince_keleseth_icc::boss_prince_kelesethAI::JustDied(), boss_prince_taldaram_icc::boss_prince_taldaramAI::JustDied(), boss_prince_valanar_icc::boss_prince_valanarAI::JustDied(), boss_sister_svalna::boss_sister_svalnaAI::JustDied(), boss_ignis::JustDied(), boss_essence_of_anger::boss_essence_of_angerAI::JustDied(), boss_ahune::JustDied(), npc_frozen_core::JustDied(), boss_twinemperorsAI::JustDied(), boss_halion::boss_halionAI::JustDied(), boss_twilight_halion::boss_twilight_halionAI::JustDied(), instance_nexus::instance_nexus_InstanceMapScript::KillAllFrayers(), KillSelf(), boss_buru::ManipulateEggs(), npc_burning_spirit::npc_burning_spiritAI::MovementInform(), spell_q12779_an_end_to_all_things_devour_aura::OnRemove(), spell_yogg_saron_insane_aura::OnRemove(), WretchedGhoulCleaner::operator()(), npc_ulduar_leviathan_mkii::PassengerBoarded(), SmartScript::ProcessAction(), instance_halls_of_reflection::instance_halls_of_reflection_InstanceMapScript::RandomizeCompositionsAndShow(), npc_cos_stratholme_citizien::npc_cos_stratholme_citizienAI::SpellHit(), boss_sister_svalna::boss_sister_svalnaAI::SpellHitTarget(), npc_oculus_drake::npc_oculus_drakeAI::SpellHitTarget(), instance_stratholme::instance_stratholme_InstanceMapScript::Update(), instance_trial_of_the_champion::instance_trial_of_the_champion_InstanceMapScript::Update(), instance_trial_of_the_crusader::instance_trial_of_the_crusader_InstanceMapScript::Update(), instance_shattered_halls::instance_shattered_halls_InstanceMapScript::Update(), SimpleCharmedAI::UpdateAI(), npc_highlord_darion_mograine::npc_highlord_darion_mograineAI::UpdateAI(), npc_hor_lich_king::npc_hor_lich_kingAI::UpdateAI(), npc_pos_leader::npc_pos_leaderAI::UpdateAI(), boss_the_lich_king::boss_the_lich_kingAI::UpdateAI(), npc_tirion_fordring_tft::npc_tirion_fordringAI::UpdateAI(), boss_sjonnir_malformed_ooze::boss_sjonnir_malformed_oozeAI::UpdateAI(), npc_ulduar_arachnopod_destroyer::UpdateAI(), npc_vh_teleportation_portal::npc_vh_teleportation_portalAI::UpdateAI(), npc_sinkhole_kill_credit::npc_sinkhole_kill_creditAI::UpdateAI(), npc_boneguard_footman::npc_boneguard_footmanAI::UpdateAI(), npc_gunship::npc_gunshipAI::UpdateAI(), and npc_emily::npc_emilyAI::WaypointReached().

◆ KillSelf()

void Unit::KillSelf ( bool  durabilityLoss = true,
WeaponAttackType  attackType = BASE_ATTACK,
SpellInfo const *  spellProto = nullptr,
Spell const *  spell = nullptr 
)
inline
1223{ Kill(this, this, durabilityLoss, attackType, spellProto, spell); };

References Kill().

Referenced by boss_felblood_kaelthas::DamageTaken(), npc_q24545_wretched_ghoul::npc_q24545_wretched_ghoulAI::DoAction(), instance_karazhan::instance_karazhan_InstanceMapScript::DoAction(), boss_kalecgos::DoAction(), boss_yoggsaron_sara::DoAction(), boss_illidari_council::DoAction(), npc_xt002_boombot::Explode(), npc_raging_flames::FixateRandomTarget(), spell_chapter2_persuasive_strike::HandleHit(), npc_rancid_mushroom::InitializeAI(), boss_warlord_kalithresh::JustDied(), npc_koltira_deathweaver::npc_koltira_deathweaverAI::MovementInform(), npc_wild_wyrm::MovementInform(), npc_pet_gen_plump_turkey::MovementInform(), npc_announcer_toc5::npc_announcer_toc5AI::MovementInform(), boss_glob_of_viscidus::MovementInform(), SmartScript::ProcessAction(), npc_singularity::Reset(), boss_archimonde::Reset(), npc_necropolis_health::SpellHit(), npc_dark_iron_guzzler::SpellHit(), boss_faerlina::boss_faerlinaAI::SpellHit(), npc_necrotic_shard::SpellHit(), boss_victor_nefarius::boss_victor_nefariusAI::SummonedCreatureDies(), boss_drakkari_colossus::boss_drakkari_colossusAI::SummonedCreatureDies(), npc_icc_gauntlet_controller::npc_icc_gauntlet_controllerAI::SummonedCreatureDies(), boss_vazruden_the_herald::SummonedCreatureDies(), npc_warden_mellichar::npc_warden_mellicharAI::SummonedCreatureDies(), npc_brewfest_super_brew_trigger::UpdateAI(), boss_krick::boss_krickAI::UpdateAI(), boss_thaddius::boss_thaddiusAI::UpdateAI(), boss_sjonnir_malformed_ooze::boss_sjonnir_malformed_oozeAI::UpdateAI(), npc_vrykul_skeleton::UpdateAI(), npc_vh_void_sentry::npc_vh_void_sentryAI::UpdateAI(), npc_target_dummy::npc_target_dummyAI::UpdateAI(), and npc_frost_tomb::UpdateAI().

◆ KnockbackFrom()

void Unit::KnockbackFrom ( float  x,
float  y,
float  speedXY,
float  speedZ 
)
15510{
15511 Player* player = ToPlayer();
15512 if (!player)
15513 {
15514 if (Unit* charmer = GetCharmer())
15515 {
15516 player = charmer->ToPlayer();
15517 if (player && player->m_mover != this)
15518 player = nullptr;
15519 }
15520 }
15521
15522 if (!player)
15523 {
15524 GetMotionMaster()->MoveKnockbackFrom(x, y, speedXY, speedZ);
15525 }
15526 else
15527 {
15528 float vcos, vsin;
15529 GetSinCos(x, y, vsin, vcos);
15530
15531 WorldPacket data(SMSG_MOVE_KNOCK_BACK, (8 + 4 + 4 + 4 + 4 + 4));
15532 data << GetPackGUID();
15533 data << player->GetSession()->GetOrderCounter(); // movement counter
15534 data << float(vcos); // x direction
15535 data << float(vsin); // y direction
15536 data << float(speedXY); // Horizontal speed
15537 data << float(-speedZ); // Z Movement speed (vertical)
15538
15539 player->SendDirectMessage(&data);
15540 player->GetSession()->IncrementOrderCounter();
15541
15542 player->SetCanKnockback(true);
15543 }
15544}
void MoveKnockbackFrom(float srcX, float srcY, float speedXY, float speedZ)
Definition MotionMaster.cpp:607
SafeUnitPointer m_mover
Definition Player.h:2366
void SetCanKnockback(bool value)
Definition Player.h:2533
WorldSession * GetSession() const
Definition Player.h:2017
uint32 GetOrderCounter() const
Definition WorldSession.h:619
void IncrementOrderCounter()
Definition WorldSession.h:620
void GetSinCos(float x, float y, float &vsin, float &vcos) const
Definition Position.cpp:99

References GetCharmer(), GetMotionMaster(), WorldSession::GetOrderCounter(), Object::GetPackGUID(), Player::GetSession(), Position::GetSinCos(), WorldSession::IncrementOrderCounter(), Player::m_mover, MotionMaster::MoveKnockbackFrom(), Player::SendDirectMessage(), Player::SetCanKnockback(), SMSG_MOVE_KNOCK_BACK, and Object::ToPlayer().

Referenced by _ExitVehicle(), boss_maexxna::boss_maexxnaAI::DoCastWebWrap(), Spell::EffectKnockBack(), spell_warhead_detonate::HandleDummy(), npc_vekjik::OnGossipSelect(), and npc_hor_leader_second::npc_hor_leader_secondAI::UpdateAI().

◆ MagicSpellHitResult()

SpellMissInfo Unit::MagicSpellHitResult ( Unit victim,
SpellInfo const *  spell 
)
3458{
3459 // Can`t miss on dead target (on skinning for example)
3460 if (!victim->IsAlive() && !victim->IsPlayer())
3461 return SPELL_MISS_NONE;
3462
3463 // vehicles cant miss
3464 if (IsVehicle())
3465 return SPELL_MISS_NONE;
3466
3467 // Spells with SPELL_ATTR3_ALWAYS_HIT will additionally fully ignore
3468 // resist and deflect chances
3469 // xinef: skip all calculations, proof: Toxic Tolerance quest
3470 if (spellInfo->HasAttribute(SPELL_ATTR3_ALWAYS_HIT))
3471 return SPELL_MISS_NONE;
3472
3473 if (spellInfo->HasAttribute(SPELL_ATTR7_NO_ATTACK_MISS))
3474 {
3475 return SPELL_MISS_NONE;
3476 }
3477
3478 SpellSchoolMask schoolMask = spellInfo->GetSchoolMask();
3479 int32 thisLevel = getLevelForTarget(victim);
3480 if (IsCreature() && ToCreature()->IsTrigger())
3481 thisLevel = std::max<int32>(thisLevel, spellInfo->SpellLevel);
3482 int32 levelDiff = int32(victim->getLevelForTarget(this)) - thisLevel;
3483
3484 int32 MISS_CHANCE_MULTIPLIER;
3485 if (sWorld->getBoolConfig(CONFIG_MISS_CHANCE_MULTIPLIER_ONLY_FOR_PLAYERS) && !IsPlayer()) // keep it as it was originally (7 and 11)
3486 {
3487 MISS_CHANCE_MULTIPLIER = victim->IsPlayer() ? 7 : 11;
3488 }
3489 else
3490 {
3491 MISS_CHANCE_MULTIPLIER = sWorld->getRate(
3492 victim->IsPlayer()
3495 }
3496
3497 // Base hit chance from attacker and victim levels
3498 int32 modHitChance = levelDiff < 3
3499 ? 96 - levelDiff
3500 : 94 - (levelDiff - 2) * MISS_CHANCE_MULTIPLIER;
3501
3502 // Spellmod from SPELLMOD_RESIST_MISS_CHANCE
3503 if (Player* modOwner = GetSpellModOwner())
3504 modOwner->ApplySpellMod(spellInfo->Id, SPELLMOD_RESIST_MISS_CHANCE, modHitChance);
3505
3506 // Increase from attacker SPELL_AURA_MOD_INCREASES_SPELL_PCT_TO_HIT auras
3508
3509 // Spells with SPELL_ATTR3_ALWAYS_HIT will ignore target's avoidance effects
3510 // xinef: imo it should completly ignore all calculations, eg: 14792. Hits 80 level players on blizz without any problems
3511 //if (!spell->HasAttribute(SPELL_ATTR3_ALWAYS_HIT))
3512 {
3513 // Chance hit from victim SPELL_AURA_MOD_ATTACKER_SPELL_HIT_CHANCE auras
3515 // Reduce spell hit chance for Area of effect spells from victim SPELL_AURA_MOD_AOE_AVOIDANCE aura
3516 if (spellInfo->IsAffectingArea())
3517 modHitChance -= victim->GetTotalAuraModifier(SPELL_AURA_MOD_AOE_AVOIDANCE);
3518
3519 // Decrease hit chance from victim rating bonus
3520 if (victim->IsPlayer())
3521 modHitChance -= int32(victim->ToPlayer()->GetRatingBonusValue(CR_HIT_TAKEN_SPELL));
3522 }
3523
3524 int32 HitChance = modHitChance * 100;
3525 // Increase hit chance from attacker SPELL_AURA_MOD_SPELL_HIT_CHANCE and attacker ratings
3526 // Xinef: Totems should inherit casters ratings?
3527 if (IsTotem())
3528 {
3529 if (Unit* owner = GetOwner())
3530 HitChance += int32(owner->m_modSpellHitChance * 100.0f);
3531 }
3532 else
3533 HitChance += int32(m_modSpellHitChance * 100.0f);
3534
3535 if (HitChance < 100)
3536 HitChance = 100;
3537 else if (HitChance > 10000)
3538 HitChance = 10000;
3539
3540 int32 tmp = 10000 - HitChance;
3541
3542 int32 rand = irand(1, 10000); // Needs to be 1 to 10000 to avoid the 1/10000 chance to miss on 100% hit rating
3543
3544 if (rand < tmp)
3545 return SPELL_MISS_MISS;
3546
3547 // Chance resist mechanic (select max value from every mechanic spell effect)
3548 int32 resist_chance = victim->GetMechanicResistChance(spellInfo) * 100;
3549 tmp += resist_chance;
3550
3551 // Chance resist debuff
3552 if (!spellInfo->IsPositive() && !spellInfo->HasAttribute(SPELL_ATTR4_NO_CAST_LOG))
3553 {
3554 bool bNegativeAura = true;
3555 for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
3556 {
3557 // Xinef: Check if effect exists!
3558 if (spellInfo->Effects[i].IsEffect() && spellInfo->Effects[i].ApplyAuraName == 0)
3559 {
3560 bNegativeAura = false;
3561 break;
3562 }
3563 }
3564
3565 if (bNegativeAura)
3566 {
3567 tmp += victim->GetMaxPositiveAuraModifierByMiscValue(SPELL_AURA_MOD_DEBUFF_RESISTANCE, int32(spellInfo->Dispel)) * 100;
3568 tmp += victim->GetMaxNegativeAuraModifierByMiscValue(SPELL_AURA_MOD_DEBUFF_RESISTANCE, int32(spellInfo->Dispel)) * 100;
3569 }
3570
3571 // Players resistance for binary spells
3572 if (spellInfo->HasAttribute(SPELL_ATTR0_CU_BINARY_SPELL) && (spellInfo->GetSchoolMask() & (SPELL_SCHOOL_MASK_NORMAL | SPELL_SCHOOL_MASK_HOLY)) == 0)
3573 tmp += int32(Unit::GetEffectiveResistChance(this, spellInfo->GetSchoolMask(), victim) * 10000.0f); // 100 for spell calculations, and 100 for return value percentage
3574 }
3575
3576 // Roll chance
3577 if (rand < tmp)
3578 return SPELL_MISS_RESIST;
3579
3580 // cast by caster in front of victim
3581 if (!victim->HasUnitState(UNIT_STATE_STUNNED) && (victim->HasInArc(M_PI, this) || victim->HasIgnoreHitDirectionAura()))
3582 {
3583 int32 deflect_chance = victim->GetTotalAuraModifier(SPELL_AURA_DEFLECT_SPELLS) * 100;
3584 tmp += deflect_chance;
3585 if (rand < tmp)
3586 return SPELL_MISS_DEFLECT;
3587 }
3588
3589 return SPELL_MISS_NONE;
3590}
int32 irand(int32 min, int32 max)
Definition Random.cpp:37
@ SPELL_ATTR7_NO_ATTACK_MISS
Definition SharedDefines.h:677
@ SPELL_MISS_NONE
Definition SharedDefines.h:1530
@ SPELL_MISS_RESIST
Definition SharedDefines.h:1532
@ SPELL_MISS_MISS
Definition SharedDefines.h:1531
@ SPELL_MISS_DEFLECT
Definition SharedDefines.h:1539
@ SPELL_AURA_MOD_DEBUFF_RESISTANCE
Definition SpellAuraDefines.h:241
@ SPELL_AURA_MOD_INCREASES_SPELL_PCT_TO_HIT
Definition SpellAuraDefines.h:262
@ SPELL_AURA_MOD_ATTACKER_SPELL_HIT_CHANCE
Definition SpellAuraDefines.h:249
@ SPELL_AURA_MOD_AOE_AVOIDANCE
Definition SpellAuraDefines.h:223
@ SPELLMOD_RESIST_MISS_CHANCE
Definition SpellDefines.h:92
@ CR_HIT_TAKEN_SPELL
Definition Unit.h:237
@ CONFIG_MISS_CHANCE_MULTIPLIER_ONLY_FOR_PLAYERS
Definition WorldConfig.h:132
@ RATE_MISS_CHANCE_MULTIPLIER_TARGET_PLAYER
Definition WorldConfig.h:489
@ RATE_MISS_CHANCE_MULTIPLIER_TARGET_CREATURE
Definition WorldConfig.h:488
float GetRatingBonusValue(CombatRating cr) const
Definition Player.cpp:5191
int32 GetMaxNegativeAuraModifierByMiscValue(AuraType auratype, int32 misc_value) const
Definition Unit.cpp:6322
int32 GetMaxPositiveAuraModifierByMiscValue(AuraType auratype, int32 misc_value) const
Definition Unit.cpp:6312
int32 GetMechanicResistChance(SpellInfo const *spell)
Definition Unit.cpp:3263

References CONFIG_MISS_CHANCE_MULTIPLIER_ONLY_FOR_PLAYERS, CR_HIT_TAKEN_SPELL, SpellInfo::Dispel, SpellInfo::Effects, GetEffectiveResistChance(), getLevelForTarget(), GetMaxNegativeAuraModifierByMiscValue(), GetMaxPositiveAuraModifierByMiscValue(), GetMechanicResistChance(), GetOwner(), Player::GetRatingBonusValue(), SpellInfo::GetSchoolMask(), GetSpellModOwner(), GetTotalAuraModifier(), GetTotalAuraModifierByMiscMask(), SpellInfo::HasAttribute(), HasIgnoreHitDirectionAura(), Position::HasInArc(), HasUnitState(), SpellInfo::Id, irand(), SpellInfo::IsAffectingArea(), IsAlive(), Object::IsCreature(), Object::IsPlayer(), SpellInfo::IsPositive(), IsTotem(), IsVehicle(), m_modSpellHitChance, MAX_SPELL_EFFECTS, RATE_MISS_CHANCE_MULTIPLIER_TARGET_CREATURE, RATE_MISS_CHANCE_MULTIPLIER_TARGET_PLAYER, SPELL_ATTR0_CU_BINARY_SPELL, SPELL_ATTR3_ALWAYS_HIT, SPELL_ATTR4_NO_CAST_LOG, SPELL_ATTR7_NO_ATTACK_MISS, SPELL_AURA_DEFLECT_SPELLS, SPELL_AURA_MOD_AOE_AVOIDANCE, SPELL_AURA_MOD_ATTACKER_SPELL_HIT_CHANCE, SPELL_AURA_MOD_DEBUFF_RESISTANCE, SPELL_AURA_MOD_INCREASES_SPELL_PCT_TO_HIT, SPELL_MISS_DEFLECT, SPELL_MISS_MISS, SPELL_MISS_NONE, SPELL_MISS_RESIST, SPELL_SCHOOL_MASK_HOLY, SPELL_SCHOOL_MASK_NORMAL, SpellInfo::SpellLevel, SPELLMOD_RESIST_MISS_CHANCE, sWorld, Object::ToCreature(), Object::ToPlayer(), and UNIT_STATE_STUNNED.

Referenced by SpellHitResult(), and SpellHitResult().

◆ MeleeDamageBonusDone()

uint32 Unit::MeleeDamageBonusDone ( Unit pVictim,
uint32  damage,
WeaponAttackType  attType,
SpellInfo const *  spellProto = nullptr,
SpellSchoolMask  damageSchoolMask = SPELL_SCHOOL_MASK_NORMAL 
)
10016{
10017 if (!victim || pdamage == 0)
10018 return 0;
10019
10020 if (IsCreature())
10021 {
10022 // Dancing Rune Weapon...
10023 if (GetEntry() == 27893)
10024 {
10025 if (Unit* owner = GetOwner())
10026 return owner->MeleeDamageBonusDone(victim, pdamage, attType, spellProto, damageSchoolMask) / 2;
10027 }
10028 }
10029
10030 uint32 creatureTypeMask = victim->GetCreatureTypeMask();
10031
10032 // Done fixed damage bonus auras
10033 int32 DoneFlatBenefit = 0;
10034
10035 // ..done
10036 DoneFlatBenefit += GetTotalAuraModifierByMiscMask(SPELL_AURA_MOD_DAMAGE_DONE_CREATURE, creatureTypeMask);
10037
10038 // ..done
10039 // SPELL_AURA_MOD_DAMAGE_DONE included in weapon damage
10040
10041 // ..done (base at attack power for marked target and base at attack power for creature type)
10042 int32 APbonus = 0;
10043
10044 if (attType == RANGED_ATTACK)
10045 {
10046 APbonus += victim->GetTotalAuraModifier(SPELL_AURA_RANGED_ATTACK_POWER_ATTACKER_BONUS);
10047
10048 // ..done (base at attack power and creature type)
10050 }
10051 else
10052 {
10053 APbonus += victim->GetTotalAuraModifier(SPELL_AURA_MELEE_ATTACK_POWER_ATTACKER_BONUS);
10054
10055 // ..done (base at attack power and creature type)
10057 }
10058
10059 if (APbonus != 0) // Can be negative
10060 {
10061 bool normalized = false;
10062 if (spellProto)
10063 for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
10064 if (spellProto->Effects[i].Effect == SPELL_EFFECT_NORMALIZED_WEAPON_DMG)
10065 {
10066 normalized = true;
10067 break;
10068 }
10069 DoneFlatBenefit += int32(APbonus / 14.0f * GetAPMultiplier(attType, normalized));
10070 }
10071
10072 // Done total percent damage auras
10073 float DoneTotalMod = 1.0f;
10074
10075 // mods for SPELL_SCHOOL_MASK_NORMAL are already factored in base melee damage calculation
10076 if (!(damageSchoolMask & SPELL_SCHOOL_MASK_NORMAL))
10077 {
10078 // Some spells don't benefit from pct done mods
10079 DoneTotalMod *= GetTotalAuraMultiplier(SPELL_AURA_MOD_DAMAGE_PERCENT_DONE, [spellProto, this, damageSchoolMask](AuraEffect const* aurEff)
10080 {
10081 if (!spellProto || (spellProto->ValidateAttribute6SpellDamageMods(this, aurEff, false)))
10082 {
10083 if ((aurEff->GetMiscValue() & damageSchoolMask))
10084 {
10085 if (aurEff->GetSpellInfo()->EquippedItemClass == -1)
10086 return true;
10087 else if (!aurEff->GetSpellInfo()->HasAttribute(SPELL_ATTR5_AURA_AFFECTS_NOT_JUST_REQ_EQUIPPED_ITEM) && (aurEff->GetSpellInfo()->EquippedItemSubClassMask == 0))
10088 return true;
10089 else if (ToPlayer() && ToPlayer()->HasItemFitToSpellRequirements(aurEff->GetSpellInfo()))
10090 return true;
10091 }
10092 }
10093 return false;
10094 });
10095 }
10096
10097 DoneTotalMod *= GetTotalAuraMultiplier(SPELL_AURA_MOD_DAMAGE_DONE_VERSUS, [creatureTypeMask, spellProto, this](AuraEffect const* aurEff)
10098 {
10099 return (creatureTypeMask & aurEff->GetMiscValue() && (!spellProto || spellProto->ValidateAttribute6SpellDamageMods(this, aurEff, false)));
10100 });
10101
10102 // bonus against aurastate
10103 DoneTotalMod *= GetTotalAuraMultiplier(SPELL_AURA_MOD_DAMAGE_DONE_VERSUS_AURASTATE, [victim, spellProto, this](AuraEffect const* aurEff)
10104 {
10105 return (victim->HasAuraState(AuraStateType(aurEff->GetMiscValue())) && (!spellProto || spellProto->ValidateAttribute6SpellDamageMods(this, aurEff, false)));
10106 });
10107
10108 // done scripted mod (take it from owner)
10109 Unit* owner = GetOwner() ? GetOwner() : this;
10110 AuraEffectList const& mOverrideClassScript = owner->GetAuraEffectsByType(SPELL_AURA_OVERRIDE_CLASS_SCRIPTS);
10111 for (AuraEffectList::const_iterator i = mOverrideClassScript.begin(); i != mOverrideClassScript.end(); ++i)
10112 {
10113 if (spellProto && !spellProto->ValidateAttribute6SpellDamageMods(this, *i, false))
10114 continue;
10115
10116 if (!(*i)->IsAffectedOnSpell(spellProto))
10117 continue;
10118
10119 switch ((*i)->GetMiscValue())
10120 {
10121 // Tundra Stalker
10122 // Merciless Combat
10123 case 7277:
10124 {
10125 // Merciless Combat
10126 if ((*i)->GetSpellInfo()->SpellIconID == 2656)
10127 {
10128 if (!victim->HealthAbovePct(35))
10129 AddPct(DoneTotalMod, (*i)->GetAmount());
10130 }
10131 // Tundra Stalker
10132 else
10133 {
10134 // Frost Fever (target debuff)
10135 if (victim->HasAura(55095))
10136 AddPct(DoneTotalMod, (*i)->GetAmount());
10137 }
10138 break;
10139 }
10140 // Rage of Rivendare
10141 case 7293:
10142 {
10143 if (victim->GetAuraEffect(SPELL_AURA_PERIODIC_DAMAGE, SPELLFAMILY_DEATHKNIGHT, 0, 0x02000000, 0))
10144 AddPct(DoneTotalMod, (*i)->GetSpellInfo()->GetRank() * 2.0f);
10145 break;
10146 }
10147 // Marked for Death
10148 case 7598:
10149 case 7599:
10150 case 7600:
10151 case 7601:
10152 case 7602:
10153 {
10154 if (victim->GetAuraEffect(SPELL_AURA_MOD_STALKED, SPELLFAMILY_HUNTER, 0x400, 0, 0))
10155 AddPct(DoneTotalMod, (*i)->GetAmount());
10156 break;
10157 }
10158 // Dirty Deeds
10159 case 6427:
10160 case 6428:
10161 {
10162 if (victim->HasAuraState(AURA_STATE_HEALTHLESS_35_PERCENT, spellProto, this))
10163 {
10164 // effect 0 has expected value but in negative state
10165 int32 bonus = -(*i)->GetBase()->GetEffect(0)->GetAmount();
10166 AddPct(DoneTotalMod, bonus);
10167 }
10168 break;
10169 }
10170 }
10171 }
10172
10173 // Custom scripted damage
10174 if (spellProto)
10175 switch (spellProto->SpellFamilyName)
10176 {
10178 // Glacier Rot
10179 if (spellProto->SpellFamilyFlags[0] & 0x2 || spellProto->SpellFamilyFlags[1] & 0x6)
10181 if (victim->GetDiseasesByCaster(owner->GetGUID()) > 0)
10182 AddPct(DoneTotalMod, aurEff->GetAmount());
10183 break;
10184 }
10185
10186 // Some spells don't benefit from done mods
10187 if (spellProto)
10188 if (spellProto->HasAttribute(SPELL_ATTR3_IGNORE_CASTER_MODIFIERS))
10189 {
10190 DoneFlatBenefit = 0;
10191 DoneTotalMod = 1.0f;
10192 }
10193
10194 float tmpDamage = float(int32(pdamage) + DoneFlatBenefit) * DoneTotalMod;
10195
10196 // apply spellmod to Done damage
10197 if (spellProto)
10198 if (Player* modOwner = GetSpellModOwner())
10199 modOwner->ApplySpellMod(spellProto->Id, SPELLMOD_DAMAGE, tmpDamage);
10200
10201 // bonus result can be negative
10202 return uint32(std::max(tmpDamage, 0.0f));
10203}
@ SPELL_EFFECT_NORMALIZED_WEAPON_DMG
Definition SharedDefines.h:910
@ SPELL_ATTR3_IGNORE_CASTER_MODIFIERS
Definition SharedDefines.h:533
@ SPELLFAMILY_HUNTER
Definition SharedDefines.h:3793
@ SPELLFAMILY_DEATHKNIGHT
Definition SharedDefines.h:3799
@ AURA_STATE_HEALTHLESS_35_PERCENT
Definition SharedDefines.h:1316
@ SPELL_AURA_MOD_MELEE_ATTACK_POWER_VERSUS
Definition SpellAuraDefines.h:165
@ SPELL_AURA_MOD_DAMAGE_DONE_VERSUS
Definition SpellAuraDefines.h:231
@ SPELL_AURA_MOD_RANGED_ATTACK_POWER_VERSUS
Definition SpellAuraDefines.h:194
@ SPELL_AURA_MOD_DAMAGE_PERCENT_DONE
Definition SpellAuraDefines.h:142
@ SPELL_AURA_MOD_DAMAGE_DONE_VERSUS_AURASTATE
Definition SpellAuraDefines.h:366
@ SPELL_AURA_MOD_DAMAGE_DONE_CREATURE
Definition SpellAuraDefines.h:122
@ SPELLMOD_DAMAGE
Definition SpellDefines.h:76
float GetAPMultiplier(WeaponAttackType attType, bool normalized)
Definition Unit.cpp:13732
AuraEffect * GetDummyAuraEffect(SpellFamilyNames name, uint32 iconId, uint8 effIndex) const
Definition Unit.h:1426

References SpellInfo::Effects, GetAPMultiplier(), GetCreatureTypeMask(), Object::GetEntry(), GetOwner(), GetTotalAuraModifier(), GetTotalAuraModifierByMiscMask(), GetTotalAuraMultiplier(), Object::IsCreature(), MAX_SPELL_EFFECTS, RANGED_ATTACK, SPELL_AURA_MELEE_ATTACK_POWER_ATTACKER_BONUS, SPELL_AURA_MOD_DAMAGE_DONE_CREATURE, SPELL_AURA_MOD_DAMAGE_PERCENT_DONE, SPELL_AURA_MOD_MELEE_ATTACK_POWER_VERSUS, SPELL_AURA_MOD_RANGED_ATTACK_POWER_VERSUS, SPELL_AURA_RANGED_ATTACK_POWER_ATTACKER_BONUS, SPELL_EFFECT_NORMALIZED_WEAPON_DMG, SPELL_SCHOOL_MASK_NORMAL, and SpellInfo::ValidateAttribute6SpellDamageMods().

Referenced by CalculateMeleeDamage(), and Spell::EffectWeaponDmg().

◆ MeleeDamageBonusTaken()

uint32 Unit::MeleeDamageBonusTaken ( Unit attacker,
uint32  pdamage,
WeaponAttackType  attType,
SpellInfo const *  spellProto = nullptr,
SpellSchoolMask  damageSchoolMask = SPELL_SCHOOL_MASK_NORMAL 
)
10206{
10207 if (pdamage == 0)
10208 return 0;
10209
10210 int32 TakenFlatBenefit = 0;
10211
10212 // ..taken
10213 TakenFlatBenefit += GetTotalAuraModifierByMiscMask(SPELL_AURA_MOD_DAMAGE_TAKEN, damageSchoolMask);
10214
10215 if (attType != RANGED_ATTACK)
10217 else
10219
10220 // Taken total percent damage auras
10221 float TakenTotalMod = 1.0f;
10222
10224
10225 // .. taken pct (special attacks)
10226 if (spellProto)
10227 {
10228 // From caster spells
10229 TakenTotalMod *= GetTotalAuraMultiplier(SPELL_AURA_MOD_DAMAGE_FROM_CASTER, [attacker, spellProto](AuraEffect const* aurEff)
10230 {
10231 return attacker->GetGUID() == aurEff->GetCasterGUID() && aurEff->IsAffectedOnSpell(spellProto);
10232 });
10233
10234 // Mod damage from spell mechanic
10235 uint32 mechanicMask = spellProto->GetAllEffectsMechanicMask();
10236
10237 // Shred, Maul - "Effects which increase Bleed damage also increase Shred damage"
10238 if (spellProto->SpellFamilyName == SPELLFAMILY_DRUID && spellProto->SpellFamilyFlags[0] & 0x00008800)
10239 mechanicMask |= (1 << MECHANIC_BLEED);
10240
10241 if (mechanicMask)
10242 {
10243 TakenTotalMod *= GetTotalAuraMultiplier(SPELL_AURA_MOD_MECHANIC_DAMAGE_TAKEN_PERCENT, [mechanicMask](AuraEffect const* aurEff) -> bool
10244 {
10245 if (mechanicMask & uint32(1 << (aurEff->GetMiscValue())))
10246 return true;
10247 return false;
10248 });
10249 }
10250 }
10251
10252 TakenTotalMod = processDummyAuras(TakenTotalMod);
10253
10254 // .. taken pct: class scripts
10255 /*AuraEffectList const& mclassScritAuras = GetAuraEffectsByType(SPELL_AURA_OVERRIDE_CLASS_SCRIPTS);
10256 for (AuraEffectList::const_iterator i = mclassScritAuras.begin(); i != mclassScritAuras.end(); ++i)
10257 {
10258 switch ((*i)->GetMiscValue())
10259 {
10260 }
10261 }*/
10262
10263 if (attType != RANGED_ATTACK)
10264 {
10266 }
10267 else
10268 {
10270 }
10271
10272 // No positive taken bonus, custom attr
10273 if (spellProto)
10274 if (spellProto->HasAttribute(SPELL_ATTR0_CU_NO_POSITIVE_TAKEN_BONUS) && TakenTotalMod > 1.0f)
10275 {
10276 TakenFlatBenefit = 0;
10277 TakenTotalMod = 1.0f;
10278 }
10279
10280 // xinef: sanctified wrath talent
10281 if (TakenTotalMod < 1.0f && attacker->HasIgnoreTargetResistAura())
10282 {
10283 float ignoreModifier = 1.0f - TakenTotalMod;
10284 bool addModifier = false;
10286 for (AuraEffectList::const_iterator j = ResIgnoreAuras.begin(); j != ResIgnoreAuras.end(); ++j)
10287 if ((*j)->GetMiscValue() & damageSchoolMask)
10288 {
10289 ApplyPct(ignoreModifier, (*j)->GetAmount());
10290 addModifier = true;
10291 }
10292
10293 if (addModifier)
10294 TakenTotalMod += ignoreModifier;
10295 }
10296
10297 float tmpDamage = (float(pdamage) + TakenFlatBenefit) * TakenTotalMod;
10298
10299 // bonus result can be negative
10300 return uint32(std::max(tmpDamage, 0.0f));
10301}
@ SPELLFAMILY_DRUID
Definition SharedDefines.h:3791
@ SPELL_AURA_MOD_RANGED_DAMAGE_TAKEN
Definition SpellAuraDefines.h:176
@ SPELL_AURA_MOD_DAMAGE_PERCENT_TAKEN
Definition SpellAuraDefines.h:150
@ SPELL_AURA_MOD_MELEE_DAMAGE_TAKEN
Definition SpellAuraDefines.h:188
@ SPELL_AURA_MOD_MELEE_DAMAGE_TAKEN_PCT
Definition SpellAuraDefines.h:189
@ SPELL_AURA_MOD_DAMAGE_TAKEN
Definition SpellAuraDefines.h:77
@ SPELL_AURA_MOD_DAMAGE_FROM_CASTER
Definition SpellAuraDefines.h:334
@ SPELL_AURA_MOD_MECHANIC_DAMAGE_TAKEN_PERCENT
Definition SpellAuraDefines.h:318
@ SPELL_AURA_MOD_RANGED_DAMAGE_TAKEN_PCT
Definition SpellAuraDefines.h:177
@ SPELL_ATTR0_CU_NO_POSITIVE_TAKEN_BONUS
Definition SpellInfo.h:197
T ApplyPct(T &base, U pct)
Definition Util.h:64
float processDummyAuras(float TakenTotalMod) const
Definition Unit.cpp:8880
bool HasIgnoreTargetResistAura() const
Definition Unit.h:1812

References ApplyPct(), SpellInfo::GetAllEffectsMechanicMask(), GetAuraEffectsByType(), AuraEffect::GetCasterGUID(), Object::GetGUID(), AuraEffect::GetMiscValue(), GetTotalAuraModifier(), GetTotalAuraModifierByMiscMask(), GetTotalAuraMultiplier(), GetTotalAuraMultiplierByMiscMask(), SpellInfo::HasAttribute(), HasIgnoreTargetResistAura(), AuraEffect::IsAffectedOnSpell(), MECHANIC_BLEED, processDummyAuras(), RANGED_ATTACK, SPELL_ATTR0_CU_NO_POSITIVE_TAKEN_BONUS, SPELL_AURA_MOD_DAMAGE_FROM_CASTER, SPELL_AURA_MOD_DAMAGE_PERCENT_TAKEN, SPELL_AURA_MOD_DAMAGE_TAKEN, SPELL_AURA_MOD_IGNORE_TARGET_RESIST, SPELL_AURA_MOD_MECHANIC_DAMAGE_TAKEN_PERCENT, SPELL_AURA_MOD_MELEE_DAMAGE_TAKEN, SPELL_AURA_MOD_MELEE_DAMAGE_TAKEN_PCT, SPELL_AURA_MOD_RANGED_DAMAGE_TAKEN, SPELL_AURA_MOD_RANGED_DAMAGE_TAKEN_PCT, SPELLFAMILY_DRUID, SpellInfo::SpellFamilyFlags, and SpellInfo::SpellFamilyName.

Referenced by CalculateMeleeDamage(), and Spell::EffectWeaponDmg().

◆ MeleeSpellHitResult()

SpellMissInfo Unit::MeleeSpellHitResult ( Unit victim,
SpellInfo const *  spell 
)
3285{
3286 // Spells with SPELL_ATTR3_ALWAYS_HIT will additionally fully ignore
3287 // resist and deflect chances
3288 if (spellInfo->HasAttribute(SPELL_ATTR3_ALWAYS_HIT))
3289 return SPELL_MISS_NONE;
3290
3291 WeaponAttackType attType = BASE_ATTACK;
3292
3293 // Check damage class instead of attack type to correctly handle judgements
3294 // - they are meele, but can't be dodged/parried/deflected because of ranged dmg class
3295 if (spellInfo->DmgClass == SPELL_DAMAGE_CLASS_RANGED)
3296 attType = RANGED_ATTACK;
3297
3298 int32 attackerWeaponSkill;
3299 // skill value for these spells (for example judgements) is 5* level
3300 if (spellInfo->DmgClass == SPELL_DAMAGE_CLASS_RANGED && !spellInfo->IsRangedWeaponSpell())
3301 attackerWeaponSkill = GetLevel() * 5;
3302 // bonus from skills is 0.04% per skill Diff
3303 else
3304 attackerWeaponSkill = int32(GetWeaponSkillValue(attType, victim));
3305
3306 int32 skillDiff = attackerWeaponSkill - int32(victim->GetMaxSkillValueForLevel(this));
3307
3308 uint32 roll = urand (0, 10000);
3309
3310 uint32 missChance = uint32(MeleeSpellMissChance(victim, attType, skillDiff, spellInfo->Id) * 100.0f);
3311 // Roll miss
3312 uint32 tmp = missChance;
3313 if (roll < tmp)
3314 return SPELL_MISS_MISS;
3315
3316 bool canDodge = !spellInfo->HasAttribute(SPELL_ATTR7_NO_ATTACK_DODGE);
3317 bool canParry = !spellInfo->HasAttribute(SPELL_ATTR7_NO_ATTACK_PARRY);
3318 bool canBlock = spellInfo->HasAttribute(SPELL_ATTR3_COMPLETELY_BLOCKED) && !spellInfo->HasAttribute(SPELL_ATTR0_CU_DIRECT_DAMAGE);
3319
3320 // Same spells cannot be parry/dodge
3321 if (spellInfo->HasAttribute(SPELL_ATTR0_NO_ACTIVE_DEFENSE))
3322 return SPELL_MISS_NONE;
3323
3324 // Chance resist mechanic
3325 int32 resist_chance = victim->GetMechanicResistChance(spellInfo) * 100;
3326 tmp += resist_chance;
3327 if (roll < tmp)
3328 return SPELL_MISS_RESIST;
3329
3330 // Ranged attacks can only miss, resist and deflect
3331 if (attType == RANGED_ATTACK)
3332 {
3333 // only if in front
3334 if (!victim->HasUnitState(UNIT_STATE_STUNNED) && (victim->HasInArc(M_PI, this) || victim->HasIgnoreHitDirectionAura()))
3335 {
3336 int32 deflect_chance = victim->GetTotalAuraModifier(SPELL_AURA_DEFLECT_SPELLS) * 100;
3337 tmp += deflect_chance;
3338 if (roll < tmp)
3339 return SPELL_MISS_DEFLECT;
3340 }
3341
3342 canDodge = false;
3343 canParry = false;
3344 }
3345
3346 // Check for attack from behind
3347 // xinef: if from behind or spell requires cast from behind
3348 if (!victim->HasInArc(M_PI, this))
3349 {
3350 if (!victim->HasIgnoreHitDirectionAura() || spellInfo->HasAttribute(SPELL_ATTR0_CU_REQ_CASTER_BEHIND_TARGET))
3351 {
3352 // Can`t dodge from behind in PvP (but its possible in PvE)
3353 if (victim->IsPlayer())
3354 {
3355 canDodge = false;
3356 }
3357
3358 // Can`t parry or block
3359 canParry = false;
3360 canBlock = false;
3361 }
3362 }
3363
3364 // Check creatures flags_extra for disable parry
3365 if (victim->IsCreature())
3366 {
3367 uint32 flagEx = victim->ToCreature()->GetCreatureTemplate()->flags_extra;
3368 // Xinef: no dodge flag
3369 if (flagEx & CREATURE_FLAG_EXTRA_NO_DODGE)
3370 canDodge = false;
3371 if (flagEx & CREATURE_FLAG_EXTRA_NO_PARRY)
3372 canParry = false;
3373 // Check creatures flags_extra for disable block
3374 if (flagEx & CREATURE_FLAG_EXTRA_NO_BLOCK)
3375 canBlock = false;
3376 }
3377 // Ignore combat result aura
3379 for (AuraEffectList::const_iterator i = ignore.begin(); i != ignore.end(); ++i)
3380 {
3381 if (!(*i)->IsAffectedOnSpell(spellInfo))
3382 continue;
3383 switch ((*i)->GetMiscValue())
3384 {
3385 case MELEE_HIT_DODGE:
3386 canDodge = false;
3387 break;
3388 case MELEE_HIT_BLOCK:
3389 canBlock = false;
3390 break;
3391 case MELEE_HIT_PARRY:
3392 canParry = false;
3393 break;
3394 default:
3395 LOG_DEBUG("entities.unit", "Spell {} SPELL_AURA_IGNORE_COMBAT_RESULT has unhandled state {}", (*i)->GetId(), (*i)->GetMiscValue());
3396 break;
3397 }
3398 }
3399
3400 if (canDodge)
3401 {
3402 // Roll dodge
3403 int32 dodgeChance = int32(victim->GetUnitDodgeChance() * 100.0f) - skillDiff * 4;
3404 // Reduce enemy dodge chance by SPELL_AURA_MOD_COMBAT_RESULT_CHANCE
3406 dodgeChance = int32(float(dodgeChance) * GetTotalAuraMultiplier(SPELL_AURA_MOD_ENEMY_DODGE));
3407 // Reduce dodge chance by attacker expertise rating
3408 if (IsPlayer())
3409 dodgeChance -= int32(ToPlayer()->GetExpertiseDodgeOrParryReduction(attType) * 100.0f);
3410 else
3412
3413 // xinef: cant dodge while casting or while stunned
3414 if (dodgeChance < 0 || victim->IsNonMeleeSpellCast(false, false, true) || victim->HasUnitState(UNIT_STATE_CONTROLLED))
3415 dodgeChance = 0;
3416
3417 tmp += dodgeChance;
3418 if (roll < tmp)
3419 return SPELL_MISS_DODGE;
3420 }
3421
3422 if (canParry)
3423 {
3424 // Roll parry
3425 int32 parryChance = int32(victim->GetUnitParryChance() * 100.0f) - skillDiff * 4;
3426 // Reduce parry chance by attacker expertise rating
3427 if (IsPlayer())
3428 parryChance -= int32(ToPlayer()->GetExpertiseDodgeOrParryReduction(attType) * 100.0f);
3429 else
3431
3432 // xinef: cant parry while casting or while stunned
3433 if (parryChance < 0 || victim->IsNonMeleeSpellCast(false, false, true) || victim->HasUnitState(UNIT_STATE_CONTROLLED))
3434 parryChance = 0;
3435
3436 tmp += parryChance;
3437 if (roll < tmp)
3438 return SPELL_MISS_PARRY;
3439 }
3440
3441 if (canBlock)
3442 {
3443 int32 blockChance = int32(victim->GetUnitBlockChance() * 100.0f) - skillDiff * 4;
3444
3445 // xinef: cant block while casting or while stunned
3446 if (blockChance < 0 || victim->IsNonMeleeSpellCast(false, false, true) || victim->HasUnitState(UNIT_STATE_CONTROLLED))
3447 blockChance = 0;
3448
3449 tmp += blockChance;
3450 if (roll < tmp)
3451 return SPELL_MISS_BLOCK;
3452 }
3453
3454 return SPELL_MISS_NONE;
3455}
@ CREATURE_FLAG_EXTRA_NO_PARRY
Definition CreatureData.h:47
@ CREATURE_FLAG_EXTRA_NO_DODGE
Definition CreatureData.h:68
@ SPELL_ATTR7_NO_ATTACK_PARRY
Definition SharedDefines.h:676
@ SPELL_ATTR7_NO_ATTACK_DODGE
Definition SharedDefines.h:675
@ SPELL_ATTR3_COMPLETELY_BLOCKED
Definition SharedDefines.h:507
@ SPELL_MISS_PARRY
Definition SharedDefines.h:1534
@ SPELL_MISS_DODGE
Definition SharedDefines.h:1533
@ SPELL_MISS_BLOCK
Definition SharedDefines.h:1535
@ SPELL_AURA_MOD_EXPERTISE
Definition SpellAuraDefines.h:303
@ SPELL_AURA_IGNORE_COMBAT_RESULT
Definition SpellAuraDefines.h:265
@ SPELL_AURA_MOD_ENEMY_DODGE
Definition SpellAuraDefines.h:314
@ SPELL_AURA_MOD_COMBAT_RESULT_CHANCE
Definition SpellAuraDefines.h:311
@ SPELL_ATTR0_CU_DIRECT_DAMAGE
Definition SpellInfo.h:184
@ SPELL_ATTR0_CU_REQ_CASTER_BEHIND_TARGET
Definition SpellInfo.h:193
WeaponAttackType
Definition Unit.h:215
float GetUnitDodgeChance() const
Definition Unit.cpp:3761
float GetUnitParryChance() const
Definition Unit.cpp:3778
float MeleeSpellMissChance(Unit const *victim, WeaponAttackType attType, int32 skillDiff, uint32 spellId) const
Definition Unit.cpp:15354
uint32 flags_extra
Definition CreatureData.h:242

References BASE_ATTACK, CREATURE_FLAG_EXTRA_NO_BLOCK, CREATURE_FLAG_EXTRA_NO_DODGE, CREATURE_FLAG_EXTRA_NO_PARRY, SpellInfo::DmgClass, CreatureTemplate::flags_extra, GetAuraEffectsByType(), Creature::GetCreatureTemplate(), GetLevel(), GetMaxSkillValueForLevel(), GetMechanicResistChance(), GetTotalAuraModifier(), GetTotalAuraModifierByMiscValue(), GetTotalAuraMultiplier(), GetUnitBlockChance(), GetUnitDodgeChance(), GetUnitParryChance(), GetWeaponSkillValue(), SpellInfo::HasAttribute(), HasIgnoreHitDirectionAura(), Position::HasInArc(), HasUnitState(), SpellInfo::Id, Object::IsCreature(), IsNonMeleeSpellCast(), Object::IsPlayer(), SpellInfo::IsRangedWeaponSpell(), LOG_DEBUG, MELEE_HIT_BLOCK, MELEE_HIT_DODGE, MELEE_HIT_PARRY, MeleeSpellMissChance(), RANGED_ATTACK, SPELL_ATTR0_CU_DIRECT_DAMAGE, SPELL_ATTR0_CU_REQ_CASTER_BEHIND_TARGET, SPELL_ATTR0_NO_ACTIVE_DEFENSE, SPELL_ATTR3_ALWAYS_HIT, SPELL_ATTR3_COMPLETELY_BLOCKED, SPELL_ATTR7_NO_ATTACK_DODGE, SPELL_ATTR7_NO_ATTACK_PARRY, SPELL_AURA_DEFLECT_SPELLS, SPELL_AURA_IGNORE_COMBAT_RESULT, SPELL_AURA_MOD_COMBAT_RESULT_CHANCE, SPELL_AURA_MOD_ENEMY_DODGE, SPELL_AURA_MOD_EXPERTISE, SPELL_DAMAGE_CLASS_RANGED, SPELL_MISS_BLOCK, SPELL_MISS_DEFLECT, SPELL_MISS_DODGE, SPELL_MISS_MISS, SPELL_MISS_NONE, SPELL_MISS_PARRY, SPELL_MISS_RESIST, Object::ToCreature(), Object::ToPlayer(), UNIT_STATE_CONTROLLED, UNIT_STATE_STUNNED, urand(), and VICTIMSTATE_DODGE.

Referenced by SpellHitResult(), and SpellHitResult().

◆ MeleeSpellMissChance()

float Unit::MeleeSpellMissChance ( Unit const *  victim,
WeaponAttackType  attType,
int32  skillDiff,
uint32  spellId 
) const
15355{
15356 SpellInfo const* spellInfo = spellId ? sSpellMgr->GetSpellInfo(spellId) : nullptr;
15357 if (spellInfo && spellInfo->HasAttribute(SPELL_ATTR7_NO_ATTACK_MISS))
15358 {
15359 return 0.0f;
15360 }
15361
15362 //calculate miss chance
15363 float missChance = victim->GetUnitMissChance(attType);
15364
15365 // Check if dual wielding, add additional miss penalty - when mainhand has on next swing spell, offhand doesnt suffer penalty
15366 if (!spellId && (attType != RANGED_ATTACK) && HasOffhandWeaponForAttack() && (!m_currentSpells[CURRENT_MELEE_SPELL] || !m_currentSpells[CURRENT_MELEE_SPELL]->IsNextMeleeSwingSpell()))
15367 {
15368 missChance += 19;
15369 }
15370
15371 // bonus from skills is 0.04%
15372 //miss_chance -= skillDiff * 0.04f;
15373 int32 diff = -skillDiff;
15374 if (victim->IsPlayer())
15375 missChance += diff > 0 ? diff * 0.04f : diff * 0.02f;
15376 else
15377 missChance += diff > 10 ? 1 + (diff - 10) * 0.4f : diff * 0.1f;
15378
15379 // Calculate hit chance
15380 float hitChance = 100.0f;
15381
15382 // Spellmod from SPELLMOD_RESIST_MISS_CHANCE
15383 if (spellId)
15384 {
15385 if (Player* modOwner = GetSpellModOwner())
15386 modOwner->ApplySpellMod(spellId, SPELLMOD_RESIST_MISS_CHANCE, hitChance);
15387 }
15388
15389 missChance -= hitChance - 100.0f;
15390
15391 if (attType == RANGED_ATTACK)
15392 missChance -= m_modRangedHitChance;
15393 else
15394 missChance -= m_modMeleeHitChance;
15395
15396 // Limit miss chance from 0 to 60%
15397 if (missChance < 0.0f)
15398 return 0.0f;
15399 if (missChance > 60.0f)
15400 return 60.0f;
15401 return missChance;
15402}

References CURRENT_MELEE_SPELL, GetSpellModOwner(), GetUnitMissChance(), SpellInfo::HasAttribute(), HasOffhandWeaponForAttack(), Object::IsPlayer(), m_currentSpells, m_modMeleeHitChance, m_modRangedHitChance, RANGED_ATTACK, SPELL_ATTR7_NO_ATTACK_MISS, SPELLMOD_RESIST_MISS_CHANCE, and sSpellMgr.

Referenced by MeleeSpellHitResult(), and RollMeleeOutcomeAgainst().

◆ ModifyAuraState()

void Unit::ModifyAuraState ( AuraStateType  flag,
bool  apply 
)
7487{
7488 if (apply)
7489 {
7490 if (!HasFlag(UNIT_FIELD_AURASTATE, 1 << (flag - 1)))
7491 {
7492 SetFlag(UNIT_FIELD_AURASTATE, 1 << (flag - 1));
7493 Unit::AuraMap& tAuras = GetOwnedAuras();
7494 for (Unit::AuraMap::iterator itr = tAuras.begin(); itr != tAuras.end(); ++itr)
7495 {
7496 if ((*itr).second->IsRemoved())
7497 continue;
7498
7499 if ((*itr).second->GetSpellInfo()->CasterAuraState == flag )
7500 if (AuraApplication* aurApp = (*itr).second->GetApplicationOfTarget(GetGUID()))
7501 (*itr).second->HandleAllEffects(aurApp, AURA_EFFECT_HANDLE_REAL, true);
7502 }
7503 }
7504 }
7505 else
7506 {
7507 if (HasFlag(UNIT_FIELD_AURASTATE, 1 << (flag - 1)))
7508 {
7509 RemoveFlag(UNIT_FIELD_AURASTATE, 1 << (flag - 1));
7510
7511 if (flag != AURA_STATE_ENRAGE) // enrage aura state triggering continues auras
7512 {
7513 Unit::AuraMap& tAuras = GetOwnedAuras();
7514 for (Unit::AuraMap::iterator itr = tAuras.begin(); itr != tAuras.end(); ++itr)
7515 {
7516 if ((*itr).second->GetSpellInfo()->CasterAuraState == flag )
7517 if (AuraApplication* aurApp = (*itr).second->GetApplicationOfTarget(GetGUID()))
7518 (*itr).second->HandleAllEffects(aurApp, AURA_EFFECT_HANDLE_REAL, false);
7519 }
7520 }
7521 }
7522 }
7523}
@ AURA_STATE_ENRAGE
Definition SharedDefines.h:1320
@ AURA_EFFECT_HANDLE_REAL
Definition SpellAuraDefines.h:42
void SetFlag(uint16 index, uint32 newFlag)
Definition Object.cpp:827
void RemoveFlag(uint16 index, uint32 oldFlag)
Definition Object.cpp:842
std::multimap< uint32, Aura * > AuraMap
Definition Unit.h:663
AuraMap & GetOwnedAuras()
Definition Unit.h:1362

References AURA_EFFECT_HANDLE_REAL, AURA_STATE_ENRAGE, Object::GetGUID(), GetOwnedAuras(), Object::HasFlag(), Object::RemoveFlag(), Object::SetFlag(), and UNIT_FIELD_AURASTATE.

Referenced by _ApplyAura(), _UnapplyAura(), ClearAllReactives(), Spell::finish(), debug_commandscript::HandleDebugSetAuraStateCommand(), boss_professor_putricide::boss_professor_putricideAI::JustSummoned(), ProcSkillsAndReactives(), Update(), and UpdateReactives().

◆ ModifyHealth()

int32 Unit::ModifyHealth ( int32  val)
11040{
11041 int32 gain = 0;
11042
11043 if (dVal == 0)
11044 return 0;
11045
11046 int32 curHealth = (int32)GetHealth();
11047
11048 int32 val = dVal + curHealth;
11049 if (val <= 0)
11050 {
11051 SetHealth(0);
11052 return -curHealth;
11053 }
11054
11055 int32 maxHealth = (int32)GetMaxHealth();
11056
11057 if (val < maxHealth)
11058 {
11059 SetHealth(val);
11060 gain = val - curHealth;
11061 }
11062 else if (curHealth != maxHealth)
11063 {
11064 SetHealth(maxHealth);
11065 gain = maxHealth - curHealth;
11066 }
11067
11068 return gain;
11069}

References GetHealth(), GetMaxHealth(), and SetHealth().

Referenced by DealDamage(), DealHeal(), boss_xt002::DoAction(), boss_ichoron::boss_ichoronAI::DoAction(), AuraEffect::HandleAuraModIncreaseHealth(), AuraEffect::HandlePeriodicHealthFunnelAuraTick(), boss_hadronox::KilledUnit(), boss_gluth::boss_gluthAI::KilledUnit(), Creature::RegenerateHealth(), Player::RegenerateHealth(), npc_injured_patient::npc_injured_patientAI::Reset(), Spell::TakePower(), Aura::Update(), and npc_infra_green_bomber_generic::npc_infra_green_bomber_genericAI::UpdateAI().

◆ ModifyPower()

int32 Unit::ModifyPower ( Powers  power,
int32  val,
bool  withPowerUpdate = true 
)
11098{
11099 if (dVal == 0)
11100 return 0;
11101
11102 int32 gain = 0;
11103
11104 int32 curPower = (int32)GetPower(power);
11105
11106 int32 val = dVal + curPower;
11107 if (val <= 0)
11108 {
11109 SetPower(power, 0, withPowerUpdate);
11110 return -curPower;
11111 }
11112
11113 int32 maxPower = (int32)GetMaxPower(power);
11114
11115 if (val < maxPower)
11116 {
11117 SetPower(power, val, withPowerUpdate);
11118 gain = val - curPower;
11119 }
11120 else if (curPower != maxPower)
11121 {
11122 SetPower(power, maxPower, withPowerUpdate);
11123 gain = maxPower - curPower;
11124 }
11125
11126 if (GetAI())
11127 {
11128 GetAI()->OnPowerUpdate(power, gain, dVal, curPower);
11129 }
11130
11131 return gain;
11132}
virtual void OnPowerUpdate(Powers, int32, int32, uint32)
Called when the creature power updates.
Definition UnitAI.h:374
void SetPower(Powers power, uint32 val, bool withPowerUpdate=true, bool fromRegenerate=false)
Definition Unit.cpp:12576

References GetAI(), GetMaxPower(), GetPower(), UnitAI::OnPowerUpdate(), and SetPower().

Referenced by CalcAbsorbResist(), spell_igb_cannon_blast::CalculatePower(), Spell::EffectPowerBurn(), Spell::EffectPowerDrain(), Spell::EffectSchoolDMG(), EnergizeBySpell(), AuraEffect::HandleObsModPowerAuraTick(), AuraEffect::HandlePeriodicEnergizeAuraTick(), AuraEffect::HandlePeriodicManaLeechAuraTick(), AuraEffect::HandlePeriodicPowerBurnAuraTick(), AuraEffect::HandlePeriodicTriggerSpellAuraTick(), spell_kelthuzad_detonate_mana_aura::HandleScript(), boss_pathaleon_the_calculator::JustEngagedWith(), boss_curator::JustEngagedWith(), Pet::LoseHappiness(), Creature::Regenerate(), RewardRage(), Pet::setDeathState(), Spell::TakePower(), Spell::TakeRunePower(), Aura::Update(), and boss_faction_championsAI::UpdateAI().

◆ ModifyRedirectThreat()

void Unit::ModifyRedirectThreat ( int32  amount)
inline
void ModifyThreatPct(int32 amount)
Definition ThreatMgr.h:311

References _redirectThreatInfo, and RedirectThreatInfo::ModifyThreatPct().

◆ ModSpellCastTime()

void Unit::ModSpellCastTime ( SpellInfo const *  spellProto,
int32 castTime,
Spell spell = nullptr 
)
Todo:
:(MadAgos) Eventually check and delete the bool argument
11854{
11855 if (!spellInfo || castTime < 0)
11856 return;
11857
11858 if (spellInfo->IsChanneled() && spellInfo->HasAura(SPELL_AURA_MOUNTED))
11859 return;
11860
11861 // called from caster
11862 if (Player* modOwner = GetSpellModOwner())
11864 modOwner->ApplySpellMod(spellInfo->Id, SPELLMOD_CASTING_TIME, castTime, spell, bool(modOwner != this && !IsPet()));
11865
11866 switch (spellInfo->DmgClass)
11867 {
11869 if (spellInfo->AttributesEx5 & SPELL_ATTR5_SPELL_HASTE_AFFECTS_PERIODIC) // required double check
11870 castTime = int32(float(castTime) * GetFloatValue(UNIT_MOD_CAST_SPEED));
11871 else if (spellInfo->SpellVisual[0] == 3881 && HasAura(67556)) // cooking with Chef Hat.
11872 castTime = 500;
11873 break;
11875 break; // no known cases
11877 castTime = CanInstantCast() ? 0 : int32(float(castTime) * GetFloatValue(UNIT_MOD_CAST_SPEED));
11878 break;
11880 castTime = int32(float(castTime) * m_modAttackSpeedPct[RANGED_ATTACK]);
11881 break;
11882 default:
11883 break;
11884 }
11885}
@ SPELL_ATTR5_SPELL_HASTE_AFFECTS_PERIODIC
Definition SharedDefines.h:591
@ SPELLMOD_CASTING_TIME
Definition SpellDefines.h:86
bool CanInstantCast() const
Definition Unit.h:1576

References SpellInfo::AttributesEx5, CanInstantCast(), SpellInfo::DmgClass, Object::GetFloatValue(), GetSpellModOwner(), SpellInfo::HasAura(), HasAura(), SpellInfo::Id, SpellInfo::IsChanneled(), IsPet(), m_modAttackSpeedPct, RANGED_ATTACK, SPELL_ATTR5_SPELL_HASTE_AFFECTS_PERIODIC, SPELL_AURA_MOUNTED, SPELL_DAMAGE_CLASS_MAGIC, SPELL_DAMAGE_CLASS_MELEE, SPELL_DAMAGE_CLASS_NONE, SPELL_DAMAGE_CLASS_RANGED, SPELLMOD_CASTING_TIME, SpellInfo::SpellVisual, and UNIT_MOD_CAST_SPEED.

Referenced by SpellInfo::CalcCastTime().

◆ ModSpellDuration()

int32 Unit::ModSpellDuration ( SpellInfo const *  spellProto,
Unit const *  target,
int32  duration,
bool  positive,
uint32  effectMask 
)
11754{
11755 // don't mod permanent auras duration
11756 if (duration < 0)
11757 return duration;
11758
11759 // some auras are not affected by duration modifiers
11760 if (spellProto->HasAttribute(SPELL_ATTR7_NO_TARGET_DURATION_MOD))
11761 return duration;
11762
11763 // cut duration only of negative effects
11764 // xinef: also calculate self casts, spell can be reflected for example
11765 if (!positive)
11766 {
11767 int32 mechanic = spellProto->GetSpellMechanicMaskByEffectMask(effectMask);
11768
11769 int32 durationMod;
11770 int32 durationMod_always = 0;
11771 int32 durationMod_not_stack = 0;
11772
11773 for (uint8 i = 1; i <= MECHANIC_ENRAGED; ++i)
11774 {
11775 if (!(mechanic & 1 << i))
11776 continue;
11777
11778 // Xinef: spells affecting movement imparing effects should not reduce duration if disoriented mechanic is present
11779 if (i == MECHANIC_SNARE && (mechanic & (1 << MECHANIC_DISORIENTED)))
11780 continue;
11781
11782 // Find total mod value (negative bonus)
11783 int32 new_durationMod_always = target->GetTotalAuraModifierByMiscValue(SPELL_AURA_MECHANIC_DURATION_MOD, i);
11784 // Find max mod (negative bonus)
11785 int32 new_durationMod_not_stack = target->GetMaxNegativeAuraModifierByMiscValue(SPELL_AURA_MECHANIC_DURATION_MOD_NOT_STACK, i);
11786 // Check if mods applied before were weaker
11787 if (new_durationMod_always < durationMod_always)
11788 durationMod_always = new_durationMod_always;
11789 if (new_durationMod_not_stack < durationMod_not_stack)
11790 durationMod_not_stack = new_durationMod_not_stack;
11791 }
11792
11793 // Select strongest negative mod
11794 if (durationMod_always > durationMod_not_stack)
11795 durationMod = durationMod_not_stack;
11796 else
11797 durationMod = durationMod_always;
11798
11799 if (durationMod != 0)
11800 AddPct(duration, durationMod);
11801
11802 // there are only negative mods currently
11803 durationMod_always = target->GetTotalAuraModifierByMiscValue(SPELL_AURA_MOD_AURA_DURATION_BY_DISPEL, spellProto->Dispel);
11804 durationMod_not_stack = target->GetMaxNegativeAuraModifierByMiscValue(SPELL_AURA_MOD_AURA_DURATION_BY_DISPEL_NOT_STACK, spellProto->Dispel);
11805
11806 durationMod = 0;
11807 if (durationMod_always > durationMod_not_stack)
11808 durationMod += durationMod_not_stack;
11809 else
11810 durationMod += durationMod_always;
11811
11812 if (durationMod != 0)
11813 AddPct(duration, durationMod);
11814 }
11815 else
11816 {
11817 // else positive mods here, there are no currently
11818 // when there will be, change GetTotalAuraModifierByMiscValue to GetTotalPositiveAuraModifierByMiscValue
11819 }
11820
11821 // Glyphs which increase duration of selfcasted buffs
11822 if (target == this)
11823 {
11824 switch (spellProto->SpellFamilyName)
11825 {
11826 case SPELLFAMILY_DRUID:
11827 if (spellProto->SpellFamilyFlags[0] & 0x100)
11828 {
11829 // Glyph of Thorns
11830 if (AuraEffect* aurEff = GetAuraEffect(57862, 0))
11831 duration += aurEff->GetAmount() * MINUTE * IN_MILLISECONDS;
11832 }
11833 break;
11835 if ((spellProto->SpellFamilyFlags[0] & 0x00000002) && spellProto->SpellIconID == 298)
11836 {
11837 // Glyph of Blessing of Might
11838 if (AuraEffect* aurEff = GetAuraEffect(57958, 0))
11839 duration += aurEff->GetAmount() * MINUTE * IN_MILLISECONDS;
11840 }
11841 else if ((spellProto->SpellFamilyFlags[0] & 0x00010000) && spellProto->SpellIconID == 306)
11842 {
11843 // Glyph of Blessing of Wisdom
11844 if (AuraEffect* aurEff = GetAuraEffect(57979, 0))
11845 duration += aurEff->GetAmount() * MINUTE * IN_MILLISECONDS;
11846 }
11847 break;
11848 }
11849 }
11850 return std::max(duration, 0);
11851}
constexpr auto IN_MILLISECONDS
Definition Common.h:53
constexpr auto MINUTE
Definition Common.h:47
@ SPELL_ATTR7_NO_TARGET_DURATION_MOD
Definition SharedDefines.h:653
@ MECHANIC_ENRAGED
Definition SharedDefines.h:1367
@ MECHANIC_DISORIENTED
Definition SharedDefines.h:1338
@ MECHANIC_SNARE
Definition SharedDefines.h:1347
@ SPELLFAMILY_PALADIN
Definition SharedDefines.h:3794
@ SPELL_AURA_MOD_AURA_DURATION_BY_DISPEL_NOT_STACK
Definition SpellAuraDefines.h:309
@ SPELL_AURA_MECHANIC_DURATION_MOD_NOT_STACK
Definition SpellAuraDefines.h:297
@ SPELL_AURA_MOD_AURA_DURATION_BY_DISPEL
Definition SpellAuraDefines.h:308
@ SPELL_AURA_MECHANIC_DURATION_MOD
Definition SpellAuraDefines.h:295

References AddPct(), SpellInfo::Dispel, AuraEffect::GetAmount(), GetAuraEffect(), GetMaxNegativeAuraModifierByMiscValue(), SpellInfo::GetSpellMechanicMaskByEffectMask(), GetTotalAuraModifierByMiscValue(), SpellInfo::HasAttribute(), IN_MILLISECONDS, MECHANIC_DISORIENTED, MECHANIC_ENRAGED, MECHANIC_SNARE, MINUTE, SPELL_ATTR7_NO_TARGET_DURATION_MOD, SPELL_AURA_MECHANIC_DURATION_MOD, SPELL_AURA_MECHANIC_DURATION_MOD_NOT_STACK, SPELL_AURA_MOD_AURA_DURATION_BY_DISPEL, SPELL_AURA_MOD_AURA_DURATION_BY_DISPEL_NOT_STACK, SPELLFAMILY_DRUID, SPELLFAMILY_PALADIN, SpellInfo::SpellFamilyFlags, SpellInfo::SpellFamilyName, and SpellInfo::SpellIconID.

Referenced by Spell::DoSpellHitOnUnit(), and Spell::EffectInterruptCast().

◆ MonsterMoveWithSpeed()

void Unit::MonsterMoveWithSpeed ( float  x,
float  y,
float  z,
float  speed 
)
639{
640 Movement::MoveSplineInit init(this);
641 init.MoveTo(x, y, z);
642 init.SetVelocity(speed);
643 init.Launch();
644}

References Movement::MoveSplineInit::Launch(), Movement::MoveSplineInit::MoveTo(), and Movement::MoveSplineInit::SetVelocity().

Referenced by CinematicMgr::UpdateCinematicLocation().

◆ Mount()

void Unit::Mount ( uint32  mount,
uint32  vehicleId = 0,
uint32  creatureEntry = 0 
)
10390{
10391 if (mount)
10393
10395
10396 if (Player* player = ToPlayer())
10397 {
10398 sScriptMgr->AnticheatSetUnderACKmount(player);
10399
10400 // mount as a vehicle
10401 if (VehicleId)
10402 {
10403 if (CreateVehicleKit(VehicleId, creatureEntry))
10404 {
10405 GetVehicleKit()->Reset();
10406
10407 // Send others that we now have a vehicle
10409 data << GetPackGUID();
10410 data << uint32(VehicleId);
10411 SendMessageToSet(&data, true);
10412
10414 player->SendDirectMessage(&data);
10415
10416 // mounts can also have accessories
10418 }
10419 }
10420
10421 // unsummon pet
10422 Pet* pet = player->GetPet();
10423 if (pet)
10424 {
10426 // don't unsummon pet in arena but SetFlag UNIT_FLAG_STUNNED to disable pet's interface
10427 if (bg && bg->isArena())
10429 else
10430 player->UnsummonPetTemporaryIfAny();
10431 }
10432
10433 // xinef: if we have charmed npc, stun him also
10434 if (Unit* charm = player->GetCharm())
10435 if (charm->IsCreature())
10436 charm->SetUnitFlag(UNIT_FLAG_STUNNED);
10437
10438 WorldPacket data(SMSG_MOVE_SET_COLLISION_HGT, GetPackGUID().size() + 4 + 4);
10439 data << GetPackGUID();
10440 data << player->GetSession()->GetOrderCounter(); // movement counter
10441 data << player->GetCollisionHeight();
10442 player->SendDirectMessage(&data);
10443 player->GetSession()->IncrementOrderCounter();
10444 }
10445
10447}
@ AURA_INTERRUPT_FLAG_MOUNT
Definition SpellDefines.h:60
bool isArena() const
Definition Battleground.h:404
bool CreateVehicleKit(uint32 id, uint32 creatureEntry)
Returns the transport this unit is on directly (if on vehicle and transport, return vehicle)
Definition Unit.cpp:15081
void Reset(bool evading=false)
Definition Vehicle.cpp:121
void InstallAllAccessories(bool evading)
Definition Vehicle.cpp:88

References AURA_INTERRUPT_FLAG_MOUNT, CreateVehicleKit(), Player::GetBattleground(), GetCharm(), Object::GetPackGUID(), GetVehicleKit(), WorldPacket::Initialize(), Vehicle::InstallAllAccessories(), Battleground::isArena(), RemoveAurasWithInterruptFlags(), Vehicle::Reset(), WorldObject::SendMessageToSet(), SetUInt32Value(), SetUnitFlag(), SMSG_MOVE_SET_COLLISION_HGT, SMSG_ON_CANCEL_EXPECTED_RIDE_VEHICLE_AURA, SMSG_PLAYER_VEHICLE_DATA, sScriptMgr, Object::ToPlayer(), UNIT_FIELD_MOUNTDISPLAYID, UNIT_FLAG_MOUNT, and UNIT_FLAG_STUNNED.

Referenced by AuraEffect::HandleAuraMounted(), spell_mount_check_aura::HandleEffectPeriodic(), modify_commandscript::HandleModifyMountCommand(), npc_lady_sylvanas_windrunner_bfu::npc_lady_sylvanas_windrunner_bfuAI::InitializeAI(), boss_captain_skarloc::InitializeAI(), npc_lady_sylvanas_windrunner_bfu::npc_lady_sylvanas_windrunner_bfuAI::JustRespawned(), Creature::LoadCreaturesAddon(), npc_thrall_old_hillsbrad::npc_thrall_old_hillsbradAI::MountSelf(), npc_koltira_deathweaver::npc_koltira_deathweaverAI::MovementInform(), npc_scarlet_courier::npc_scarlet_courierAI::Reset(), npc_thrall_bfu::npc_thrall_bfuAI::Reset(), boss_mandokir::boss_mandokirAI::Reset(), and WorldSession::SendDoFlight().

◆ NearTeleportTo() [1/2]

void Unit::NearTeleportTo ( float  x,
float  y,
float  z,
float  orientation,
bool  casting = false,
bool  vehicleTeleport = false,
bool  withPet = false,
bool  removeTransport = false 
)
16079{
16080 DisableSpline();
16081 if (IsPlayer())
16082 ToPlayer()->TeleportTo(GetMapId(), x, y, z, orientation, TELE_TO_NOT_LEAVE_COMBAT | (removeTransport ? 0 : TELE_TO_NOT_LEAVE_TRANSPORT) | TELE_TO_NOT_UNSUMMON_PET | (casting ? TELE_TO_SPELL : 0) | (vehicleTeleport ? TELE_TO_NOT_LEAVE_VEHICLE : 0) | (withPet ? TELE_TO_WITH_PET : 0));
16083 else
16084 {
16085 Position pos = {x, y, z, orientation};
16086 SendTeleportPacket(pos);
16087 UpdatePosition(x, y, z, orientation, true);
16090 }
16091}
@ TELE_TO_WITH_PET
Definition Player.h:820
@ TELE_TO_NOT_LEAVE_VEHICLE
Definition Player.h:819
@ TELE_TO_SPELL
Definition Player.h:818
@ TELE_TO_NOT_LEAVE_COMBAT
Definition Player.h:816
@ TELE_TO_NOT_UNSUMMON_PET
Definition Player.h:817
@ TELE_TO_NOT_LEAVE_TRANSPORT
Definition Player.h:815
void ReinitializeMovement()
Definition MotionMaster.cpp:940
bool TeleportTo(uint32 mapid, float x, float y, float z, float orientation, uint32 options=0, Unit *target=nullptr, bool newInstance=false)
Definition Player.cpp:1353
void SendTeleportPacket(Position &pos)
Definition Unit.cpp:16100
void UpdateObjectVisibility(bool forced=true, bool fromUpdate=false) override
Definition Unit.cpp:15496
virtual bool UpdatePosition(float x, float y, float z, float ang, bool teleport=false)
Definition Unit.cpp:16119

References DisableSpline(), WorldLocation::GetMapId(), GetMotionMaster(), Object::IsPlayer(), MotionMaster::ReinitializeMovement(), SendTeleportPacket(), TELE_TO_NOT_LEAVE_COMBAT, TELE_TO_NOT_LEAVE_TRANSPORT, TELE_TO_NOT_LEAVE_VEHICLE, TELE_TO_NOT_UNSUMMON_PET, TELE_TO_SPELL, TELE_TO_WITH_PET, Player::TeleportTo(), Object::ToPlayer(), UpdateObjectVisibility(), and UpdatePosition().

◆ NearTeleportTo() [2/2]

void Unit::NearTeleportTo ( Position pos,
bool  casting = false,
bool  vehicleTeleport = false,
bool  withPet = false,
bool  removeTransport = false 
)
16074{
16075 NearTeleportTo(pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), pos.GetOrientation(), casting, vehicleTeleport, withPet, removeTransport);
16076}
void NearTeleportTo(Position &pos, bool casting=false, bool vehicleTeleport=false, bool withPet=false, bool removeTransport=false)
Definition Unit.cpp:16073

References Position::GetOrientation(), Position::GetPositionX(), Position::GetPositionY(), Position::GetPositionZ(), and NearTeleportTo().

Referenced by boss_viscidus::DamageTaken(), npc_madrigosa::DoAction(), npc_akama_illidan::DoAction(), Spell::EffectLeap(), Spell::EffectResurrectPet(), Spell::EffectStuck(), Spell::EffectSummonPet(), Spell::EffectTeleportUnits(), Spell::EffectTeleUnitsFaceCaster(), npc_giant_claw_tentacle::Emerge(), boss_yoggsaron_sara::EnterEvadeMode(), UtherBatteredHiltEvent::Execute(), BattlegroundBE::HandleAreaTrigger(), BattlegroundDS::HandleAreaTrigger(), BattlegroundNA::HandleAreaTrigger(), BattlegroundRL::HandleAreaTrigger(), BattlegroundRV::HandleAreaTrigger(), spell_moroes_vanish::HandleDummy(), spell_class_call_handler::HandleOnHitRogue(), npc_echo_of_medivh::HandlePieceJustDied(), BattlegroundBE::HandlePlayerUnderMap(), BattlegroundDS::HandlePlayerUnderMap(), BattlegroundNA::HandlePlayerUnderMap(), BattlegroundRL::HandlePlayerUnderMap(), BattlegroundRV::HandlePlayerUnderMap(), npc_pet_mage_mirror_image::InitializeAI(), boss_urom::boss_uromAI::JustDied(), boss_stormcaller_brundir::JustDied(), boss_noth::boss_nothAI::JustDied(), boss_grandmaster_vorpil::JustEngagedWith(), NearTeleportTo(), npc_ball_of_flame::npc_ball_of_flameAI::npc_ball_of_flameAI(), npc_chesspiece::OnCharmed(), npc_vh_sinclari::OnGossipSelect(), npc_cos_chromie_start::OnGossipSelect(), npc_chesspiece::Reset(), boss_gothik::boss_gothikAI::Reset(), Map::ScriptsProcess(), npc_simon_bunny::npc_simon_bunnyAI::SetUpPreGame(), boss_urom::boss_uromAI::SpellHit(), boss_majordomo::boss_majordomoAI::SpellHit(), npc_frostwing_vrykul::npc_frostwing_vrykulAI::SpellHitTarget(), npc_nerubian_burrower::npc_nerubian_burrowerAI::SpellHitTarget(), npc_pos_leader_second::npc_pos_leader_secondAI::SpellHitTarget(), boss_cyanigosa::boss_cyanigosaAI::SpellHitTarget(), BattlegroundRV::TeleportUnitToNewZ(), Vehicle::TeleportVehicle(), npc_doomfire_spirit::TryTeleportInDirection(), boss_rend_blackhand::boss_rend_blackhandAI::UpdateAI(), npc_highlord_darion_mograine::npc_highlord_darion_mograineAI::UpdateAI(), boss_renataki::boss_renatakiAI::UpdateAI(), npc_coldflame::npc_coldflameAI::UpdateAI(), boss_magus_telestra::UpdateAI(), boss_urom::boss_uromAI::UpdateAI(), boss_thorim_sif::UpdateAI(), boss_yoggsaron_sara::UpdateAI(), boss_svala::boss_svalaAI::UpdateAI(), and npc_minigob_manabonk::UpdateAI().

◆ OutDebugInfo()

void Unit::OutDebugInfo ( ) const
16329{
16330 LOG_ERROR("entities.unit", "Unit::OutDebugInfo");
16331 LOG_INFO("entities.unit", "GUID {}, name {}", GetGUID().ToString(), GetName());
16332 LOG_INFO("entities.unit", "OwnerGUID {}, MinionGUID {}, CharmerGUID {}, CharmedGUID {}",
16334 LOG_INFO("entities.unit", "In world {}, unit type mask {}", (uint32)(IsInWorld() ? 1 : 0), m_unitTypeMask);
16335 if (IsInWorld())
16336 LOG_INFO("entities.unit", "Mapid {}", GetMapId());
16337
16338 LOG_INFO("entities.unit", "Summon Slot: ");
16339 for (uint32 i = 0; i < MAX_SUMMON_SLOT; ++i)
16340 LOG_INFO("entities.unit", "{}, ", m_SummonSlot[i].ToString());
16341 LOG_INFO("server.loading", " ");
16342
16343 LOG_INFO("entities.unit", "Controlled List: ");
16344 for (ControlSet::const_iterator itr = m_Controlled.begin(); itr != m_Controlled.end(); ++itr)
16345 LOG_INFO("entities.unit", "{}, ", (*itr)->GetGUID().ToString());
16346 LOG_INFO("server.loading", " ");
16347
16348 LOG_INFO("entities.unit", "Aura List: ");
16349 for (AuraApplicationMap::const_iterator itr = m_appliedAuras.begin(); itr != m_appliedAuras.end(); ++itr)
16350 LOG_INFO("entities.unit", "{}, ", itr->first);
16351 LOG_INFO("server.loading", " ");
16352
16353 if (IsVehicle())
16354 {
16355 LOG_INFO("entities.unit", "Passenger List: ");
16356 for (SeatMap::iterator itr = GetVehicleKit()->Seats.begin(); itr != GetVehicleKit()->Seats.end(); ++itr)
16357 if (Unit* passenger = ObjectAccessor::GetUnit(*GetVehicleBase(), itr->second.Passenger.Guid))
16358 LOG_INFO("entities.unit", "{}, ", passenger->GetGUID().ToString());
16359 LOG_INFO("server.loading", " ");
16360 }
16361
16362 if (GetVehicle())
16363 LOG_INFO("entities.unit", "On vehicle {}.", GetVehicleBase()->GetEntry());
16364}
Seats
Definition boss_flame_leviathan.cpp:168
SeatMap Seats
Definition Vehicle.h:57

References GetCharmerGUID(), GetCharmGUID(), Object::GetEntry(), Object::GetGUID(), WorldLocation::GetMapId(), GetMinionGUID(), WorldObject::GetName(), GetOwnerGUID(), ObjectAccessor::GetUnit(), GetVehicle(), GetVehicleBase(), GetVehicleKit(), Object::IsInWorld(), IsVehicle(), LOG_ERROR, LOG_INFO, m_appliedAuras, m_Controlled, m_SummonSlot, m_unitTypeMask, MAX_SUMMON_SLOT, Vehicle::Seats, and Position::ToString().

Referenced by SetMinion().

◆ PatchValuesUpdate()

void Unit::PatchValuesUpdate ( ByteBuffer valuesUpdateBuf,
BuildValuesCachePosPointers posPointers,
Player target 
)
private
17055{
17056 Creature const* creature = ToCreature();
17057
17058 // UNIT_NPC_FLAGS
17059 if (creature && posPointers.UnitNPCFlagsPos >= 0)
17060 {
17061 uint32 appendValue = m_uint32Values[UNIT_NPC_FLAGS];
17062
17063 if (sWorld->getIntConfig(CONFIG_INSTANT_TAXI) == 2 && appendValue & UNIT_NPC_FLAG_FLIGHTMASTER)
17064 appendValue |= UNIT_NPC_FLAG_GOSSIP; // flight masters need NPC gossip flag to show instant flight toggle option
17065
17066 if (!target->CanSeeSpellClickOn(creature))
17067 appendValue &= ~UNIT_NPC_FLAG_SPELLCLICK;
17068
17069 if (!target->CanSeeVendor(creature))
17070 {
17071 appendValue &= ~UNIT_NPC_FLAG_REPAIR;
17072 appendValue &= ~UNIT_NPC_FLAG_VENDOR_MASK;
17073 }
17074
17075 if (!target->CanSeeTrainer(creature))
17076 appendValue &= ~UNIT_NPC_FLAG_TRAINER;
17077
17078 valuesUpdateBuf.put(posPointers.UnitNPCFlagsPos, appendValue);
17079 }
17080
17081 // UNIT_FIELD_AURASTATE
17082 if (posPointers.UnitFieldAuraStatePos >= 0)
17083 valuesUpdateBuf.put(posPointers.UnitFieldAuraStatePos, uint32(BuildAuraStateUpdateForTarget(target)));
17084
17085 // UNIT_FIELD_FLAGS
17086 if (posPointers.UnitFieldFlagsPos >= 0)
17087 {
17088 uint32 appendValue = m_uint32Values[UNIT_FIELD_FLAGS];
17089 if (target->IsGameMaster() && target->GetSession()->IsGMAccount())
17090 appendValue &= ~UNIT_FLAG_NOT_SELECTABLE;
17091
17092 valuesUpdateBuf.put(posPointers.UnitFieldFlagsPos, appendValue);
17093 }
17094
17095 // UNIT_FIELD_DISPLAYID
17096 // Use modelid_a if not gm, _h if gm for CREATURE_FLAG_EXTRA_TRIGGER creatures.
17097 if (posPointers.UnitFieldDisplayPos >= 0)
17098 {
17100 if (creature)
17101 {
17102 CreatureTemplate const* cinfo = creature->GetCreatureTemplate();
17103
17104 // this also applies for transform auras
17105 if (SpellInfo const* transform = sSpellMgr->GetSpellInfo(getTransForm()))
17106 for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
17107 if (transform->Effects[i].IsAura(SPELL_AURA_TRANSFORM))
17108 if (CreatureTemplate const* transformInfo = sObjectMgr->GetCreatureTemplate(transform->Effects[i].MiscValue))
17109 {
17110 cinfo = transformInfo;
17111 break;
17112 }
17113
17115 {
17116 if (target->IsGameMaster() && target->GetSession()->IsGMAccount())
17117 displayId = cinfo->GetFirstVisibleModel()->CreatureDisplayID;
17118 else
17119 displayId = cinfo->GetFirstInvisibleModel()->CreatureDisplayID;
17120 }
17121 }
17122
17123 valuesUpdateBuf.put(posPointers.UnitFieldDisplayPos, uint32(displayId));
17124 }
17125
17126 // UNIT_DYNAMIC_FLAGS
17127 // Hide lootable animation for unallowed players.
17128 if (posPointers.UnitDynamicFlagsPos >= 0)
17129 {
17131
17132 if (creature)
17133 {
17134 if (creature->hasLootRecipient())
17135 {
17136 dynamicFlags |= UNIT_DYNFLAG_TAPPED;
17137 if (creature->isTappedBy(target))
17138 dynamicFlags |= UNIT_DYNFLAG_TAPPED_BY_PLAYER;
17139 }
17140
17141 if (!target->isAllowedToLoot(creature))
17142 dynamicFlags &= ~UNIT_DYNFLAG_LOOTABLE;
17143 }
17144
17145 // unit UNIT_DYNFLAG_TRACK_UNIT should only be sent to caster of SPELL_AURA_MOD_STALKED auras
17146 if (dynamicFlags & UNIT_DYNFLAG_TRACK_UNIT)
17148 dynamicFlags &= ~UNIT_DYNFLAG_TRACK_UNIT;
17149
17150 valuesUpdateBuf.put(posPointers.UnitDynamicFlagsPos, dynamicFlags);
17151 }
17152
17153 // UNIT_FIELD_BYTES_2
17154 if (posPointers.UnitFieldBytes2Pos >= 0)
17155 {
17156 if (IsControlledByPlayer() && target != this && sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_GROUP) && IsInRaidWith(target))
17157 {
17159 FactionTemplateEntry const* ft2 = target->GetFactionTemplateEntry();
17160 if (ft1 && ft2 && !ft1->IsFriendlyTo(*ft2))
17161 // Allow targetting opposite faction in party when enabled in config
17162 valuesUpdateBuf.put(posPointers.UnitFieldBytes2Pos, (m_uint32Values[UNIT_FIELD_BYTES_2] & ((UNIT_BYTE2_FLAG_SANCTUARY /*| UNIT_BYTE2_FLAG_AURAS | UNIT_BYTE2_FLAG_UNK5*/) << 8))); // this flag is at uint8 offset 1 !!
17163 }// pussywizard / Callmephil
17164 else if (target->IsSpectator() && target->FindMap() && target->FindMap()->IsBattleArena() &&
17165 (this->IsPlayer() || this->IsCreature() || this->IsDynamicObject()))
17166 {
17167 valuesUpdateBuf.put(posPointers.UnitFieldBytes2Pos, (m_uint32Values[UNIT_FIELD_BYTES_2] & 0xFFFFF2FF)); // clear UNIT_BYTE2_FLAG_PVP, UNIT_BYTE2_FLAG_FFA_PVP, UNIT_BYTE2_FLAG_SANCTUARY
17168 }
17169 }
17170
17171 // UNIT_FIELD_FACTIONTEMPLATE
17172 if (posPointers.UnitFieldFactionTemplatePos >= 0)
17173 {
17174 if (IsControlledByPlayer() && target != this && sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_GROUP) && IsInRaidWith(target))
17175 {
17177 FactionTemplateEntry const* ft2 = target->GetFactionTemplateEntry();
17178 if (ft1 && ft2 && !ft1->IsFriendlyTo(*ft2))
17179 // pretend that all other HOSTILE players have own faction, to allow follow, heal, rezz (trade wont work)
17180 valuesUpdateBuf.put(posPointers.UnitFieldFactionTemplatePos, uint32(target->GetFaction()));
17181 }// pussywizard / Callmephil
17182 else if (target->IsSpectator() && target->FindMap() && target->FindMap()->IsBattleArena() &&
17183 (this->IsPlayer() || this->IsCreature() || this->IsDynamicObject()))
17184 {
17185 valuesUpdateBuf.put(posPointers.UnitFieldFactionTemplatePos, uint32(target->GetFaction()));
17186 }
17187 else if (target->IsGMSpectator() && IsControlledByPlayer())
17188 {
17189 valuesUpdateBuf.put(posPointers.UnitFieldFactionTemplatePos, uint32(target->GetFaction()));
17190 }
17191 }
17192
17193 sScriptMgr->OnPatchValuesUpdate(this, valuesUpdateBuf, posPointers, target);
17194}
@ CREATURE_FLAG_EXTRA_TRIGGER
Definition CreatureData.h:52
@ UNIT_DYNFLAG_TRACK_UNIT
Definition SharedDefines.h:3362
@ CONFIG_INSTANT_TAXI
Definition WorldConfig.h:341
@ CONFIG_ALLOW_TWO_SIDE_INTERACTION_GROUP
Definition WorldConfig.h:34
void put(std::size_t pos, T value)
Definition ByteBuffer.h:137
bool isTappedBy(Player const *player) const
Definition Creature.cpp:1342
bool isAllowedToLoot(Creature const *creature)
Definition PlayerStorage.cpp:5682
bool CanSeeTrainer(Creature const *creature) const
Definition Player.cpp:14389
bool CanSeeVendor(Creature const *creature) const
Definition Player.cpp:14373
bool IsGMSpectator() const
Definition Player.h:1178
bool IsSpectator() const
Definition Player.h:2607
bool CanSeeSpellClickOn(Creature const *creature) const
Definition Player.cpp:14283
uint32 BuildAuraStateUpdateForTarget(Unit *target) const
Definition Unit.cpp:7525
bool IsGMAccount() const
Definition WorldSession.cpp:206
int32 UnitFieldFlagsPos
Definition UnitUtils.h:99
int32 UnitFieldDisplayPos
Definition UnitUtils.h:100
int32 UnitDynamicFlagsPos
Definition UnitUtils.h:101
int32 UnitFieldAuraStatePos
Definition UnitUtils.h:98
int32 UnitFieldFactionTemplatePos
Definition UnitUtils.h:103
int32 UnitFieldBytes2Pos
Definition UnitUtils.h:102
int32 UnitNPCFlagsPos
Definition UnitUtils.h:97
uint32 CreatureDisplayID
Definition CreatureData.h:179
CreatureModel const * GetFirstInvisibleModel() const
Definition Creature.cpp:154
CreatureModel const * GetFirstVisibleModel() const
Definition Creature.cpp:164

References BuildAuraStateUpdateForTarget(), Player::CanSeeSpellClickOn(), Player::CanSeeTrainer(), Player::CanSeeVendor(), CONFIG_ALLOW_TWO_SIDE_INTERACTION_GROUP, CONFIG_INSTANT_TAXI, CREATURE_FLAG_EXTRA_TRIGGER, CreatureModel::CreatureDisplayID, WorldObject::FindMap(), Creature::GetCreatureTemplate(), GetFaction(), GetFactionTemplateEntry(), CreatureTemplate::GetFirstInvisibleModel(), CreatureTemplate::GetFirstVisibleModel(), Object::GetGUID(), Player::GetSession(), getTransForm(), HasAuraTypeWithCaster(), CreatureTemplate::HasFlagsExtra(), Creature::hasLootRecipient(), Player::isAllowedToLoot(), Map::IsBattleArena(), IsControlledByPlayer(), FactionTemplateEntry::IsFriendlyTo(), Player::IsGameMaster(), WorldSession::IsGMAccount(), Player::IsGMSpectator(), IsInRaidWith(), Player::IsSpectator(), Creature::isTappedBy(), Object::m_uint32Values, MAX_SPELL_EFFECTS, ByteBuffer::put(), sObjectMgr, SPELL_AURA_MOD_STALKED, SPELL_AURA_TRANSFORM, sScriptMgr, sSpellMgr, sWorld, Object::ToCreature(), UNIT_BYTE2_FLAG_SANCTUARY, UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_LOOTABLE, UNIT_DYNFLAG_TAPPED, UNIT_DYNFLAG_TAPPED_BY_PLAYER, UNIT_DYNFLAG_TRACK_UNIT, UNIT_FIELD_BYTES_2, UNIT_FIELD_DISPLAYID, UNIT_FIELD_FLAGS, UNIT_NPC_FLAG_FLIGHTMASTER, UNIT_NPC_FLAG_GOSSIP, UNIT_NPC_FLAGS, BuildValuesCachePosPointers::UnitDynamicFlagsPos, BuildValuesCachePosPointers::UnitFieldAuraStatePos, BuildValuesCachePosPointers::UnitFieldBytes2Pos, BuildValuesCachePosPointers::UnitFieldDisplayPos, BuildValuesCachePosPointers::UnitFieldFactionTemplatePos, BuildValuesCachePosPointers::UnitFieldFlagsPos, and BuildValuesCachePosPointers::UnitNPCFlagsPos.

Referenced by BuildValuesUpdate().

◆ PauseMovement()

void Unit::PauseMovement ( uint32  timer = 0,
uint8  slot = 0 
)
virtual

Disable the unit movement by clearing UNIT_STATE_MOVING and stopping the spline.

13156{
13157 if (slot >= MAX_MOTION_SLOT)
13158 return;
13159
13160 if (MovementGenerator* movementGenerator = GetMotionMaster()->GetMotionSlot(slot))
13161 movementGenerator->Pause(timer);
13162
13163 StopMoving();
13164}
@ MAX_MOTION_SLOT
Definition MotionMaster.h:66
Definition MovementGenerator.h:28
void StopMoving()
Definition Unit.cpp:13136

References GetMotionMaster(), MAX_MOTION_SLOT, and StopMoving().

Referenced by WorldSession::HandleBattlemasterHelloOpcode(), WorldSession::HandleGossipHelloOpcode(), spell_chapter5_return_to_capital::HandleHit(), WorldSession::HandleQuestgiverHelloOpcode(), WorldSession::SendListInventory(), boss_shade_of_aran::SetGUID(), npc_acherus_necromancer::npc_acherus_necromancerAI::UpdateAI(), and npc_gothik_the_harvester::npc_gothik_the_harvesterAI::UpdateAI().

◆ PetSpellFail()

void Unit::PetSpellFail ( SpellInfo const *  spellInfo,
Unit target,
uint32  result 
)
16439{
16440 CharmInfo* charmInfo = GetCharmInfo();
16441 if (!charmInfo || !IsCreature())
16442 return;
16443
16444 if ((sDisableMgr->IsPathfindingEnabled(GetMap()) || result != SPELL_FAILED_LINE_OF_SIGHT) && target)
16445 {
16446 if ((result == SPELL_FAILED_LINE_OF_SIGHT || result == SPELL_FAILED_OUT_OF_RANGE) || !ToCreature()->HasReactState(REACT_PASSIVE))
16447 if (Unit* owner = GetOwner())
16448 {
16449 if (spellInfo->IsPositive() && IsFriendlyTo(target))
16450 {
16451 AttackStop();
16452 charmInfo->SetIsAtStay(false);
16453 charmInfo->SetIsCommandAttack(true);
16454 charmInfo->SetIsReturning(false);
16455 charmInfo->SetIsFollowing(false);
16456
16457 GetMotionMaster()->MoveFollow(target, PET_FOLLOW_DIST, rand_norm() * 2 * M_PI);
16458 }
16459 else if (owner->IsValidAttackTarget(target))
16460 {
16461 AttackStop();
16462 charmInfo->SetIsAtStay(false);
16463 charmInfo->SetIsCommandAttack(true);
16464 charmInfo->SetIsReturning(false);
16465 charmInfo->SetIsFollowing(false);
16466
16467 if (!ToCreature()->HasReactState(REACT_PASSIVE))
16468 ToCreature()->AI()->AttackStart(target);
16469 else
16470 GetMotionMaster()->MoveChase(target);
16471 }
16472 }
16473
16474 // can be extended in future
16475 if (result == SPELL_FAILED_LINE_OF_SIGHT || result == SPELL_FAILED_OUT_OF_RANGE)
16476 {
16477 charmInfo->SetForcedSpell(spellInfo->IsPositive() ? -int32(spellInfo->Id) : spellInfo->Id);
16478 charmInfo->SetForcedTargetGUID(target->GetGUID());
16479 }
16480 else
16481 {
16482 charmInfo->SetForcedSpell(0);
16484 }
16485 }
16486}
#define sDisableMgr
Definition DisableMgr.h:88
constexpr float PET_FOLLOW_DIST
Definition PetDefines.h:206
@ SPELL_FAILED_OUT_OF_RANGE
Definition SharedDefines.h:1057
@ SPELL_FAILED_LINE_OF_SIGHT
Definition SharedDefines.h:1007
void MoveChase(Unit *target, std::optional< ChaseRange > dist={}, std::optional< ChaseAngle > angle={})
Force the unit to chase this target. Doesn't work with UNIT_FLAG_DISABLE_MOVE.
Definition MotionMaster.cpp:314
void MoveFollow(Unit *target, float dist, float angle, MovementSlot slot=MOTION_SLOT_ACTIVE, bool inheritWalkState=true, bool inheritSpeed=true)
The unit will follow this target. Doesn't work with UNIT_FLAG_DISABLE_MOVE.
Definition MotionMaster.cpp:446
virtual void AttackStart(Unit *)
Definition UnitAI.cpp:27
bool IsFriendlyTo(Unit const *unit) const
Definition Unit.cpp:7205
void SetIsAtStay(bool val)
Definition CharmInfo.cpp:365
void SetIsFollowing(bool val)
Definition CharmInfo.cpp:375
void SetIsReturning(bool val)
Definition CharmInfo.cpp:385
void SetForcedSpell(uint32 id)
Definition CharmInfo.h:177
void SetForcedTargetGUID(ObjectGuid guid=ObjectGuid::Empty)
Definition CharmInfo.h:179
void SetIsCommandAttack(bool val)
Definition CharmInfo.cpp:303

References Creature::AI(), UnitAI::AttackStart(), AttackStop(), ObjectGuid::Empty, GetCharmInfo(), Object::GetGUID(), WorldObject::GetMap(), GetMotionMaster(), GetOwner(), SpellInfo::Id, Object::IsCreature(), IsFriendlyTo(), SpellInfo::IsPositive(), MotionMaster::MoveChase(), MotionMaster::MoveFollow(), PET_FOLLOW_DIST, rand_norm(), REACT_PASSIVE, sDisableMgr, CharmInfo::SetForcedSpell(), CharmInfo::SetForcedTargetGUID(), CharmInfo::SetIsAtStay(), CharmInfo::SetIsCommandAttack(), CharmInfo::SetIsFollowing(), CharmInfo::SetIsReturning(), SPELL_FAILED_LINE_OF_SIGHT, SPELL_FAILED_OUT_OF_RANGE, and Object::ToCreature().

Referenced by WorldSession::HandlePetActionHelper(), and WorldSession::HandlePetCastSpellOpcode().

◆ processDummyAuras()

float Unit::processDummyAuras ( float  TakenTotalMod) const
private
8881{
8882 // note: old code coming from TC, just extracted here to remove the code duplication + solve potential crash
8883 // see: https://github.com/TrinityCore/TrinityCore/commit/c85710e148d75450baedf6632b9ca6fd40b4148e
8884
8885 // .. taken pct: dummy auras
8886 auto const& mDummyAuras = GetAuraEffectsByType(SPELL_AURA_DUMMY);
8887 for (auto i = mDummyAuras.begin(); i != mDummyAuras.end(); ++i)
8888 {
8889 if (!(*i) || !(*i)->GetSpellInfo())
8890 {
8891 continue;
8892 }
8893
8894 if (auto spellIconId = (*i)->GetSpellInfo()->SpellIconID)
8895 {
8896 switch (spellIconId)
8897 {
8898 // Cheat Death
8899 case 2109:
8900 if ((*i)->GetMiscValue() & SPELL_SCHOOL_MASK_NORMAL)
8901 {
8902 // Patch 2.4.3: The resilience required to reach the 90% damage reduction cap
8903 // is 22.5% critical strike damage reduction, or 444 resilience.
8904 // To calculate for 90%, we multiply the 100% by 4 (22.5% * 4 = 90%)
8905 float mod = -1.0f * GetMeleeCritDamageReduction(400);
8906 AddPct(TakenTotalMod, std::max(mod, float((*i)->GetAmount())));
8907 }
8908 break;
8909 }
8910 }
8911 }
8912 return TakenTotalMod;
8913}

References AddPct(), GetAuraEffectsByType(), GetMeleeCritDamageReduction(), SPELL_AURA_DUMMY, and SPELL_SCHOOL_MASK_NORMAL.

Referenced by MeleeDamageBonusTaken(), and SpellDamageBonusTaken().

◆ ProcessPositionDataChanged()

void Unit::ProcessPositionDataChanged ( PositionFullTerrainStatus const &  data)
overridevirtual

Reimplemented from WorldObject.

4407{
4410}
virtual void ProcessTerrainStatusUpdate()
Definition Unit.cpp:4412
virtual void ProcessPositionDataChanged(PositionFullTerrainStatus const &data)
Definition Object.cpp:1164

References WorldObject::ProcessPositionDataChanged(), and ProcessTerrainStatusUpdate().

Referenced by Creature::Create().

◆ ProcessTerrainStatusUpdate()

void Unit::ProcessTerrainStatusUpdate ( )
virtual

Reimplemented in Player.

4413{
4414 if (IsCreature())
4416
4417 if (IsFlying() || (!IsControlledByPlayer()))
4418 return;
4419
4420 LiquidData const& liquidData = GetLiquidData();
4421
4422 // remove appropriate auras if we are swimming/not swimming respectively - exact mirror of client logic
4423 if (liquidData.Status & MAP_LIQUID_STATUS_SWIMMING && (liquidData.Level - GetPositionZ()) > GetCollisionHeight() * 0.75f) // Shallow water at ~75% of collision height)
4425 else
4427
4428 // liquid aura handling
4429 LiquidTypeEntry const* curLiquid = nullptr;
4430 if ((liquidData.Status & MAP_LIQUID_STATUS_SWIMMING))
4431 curLiquid = sLiquidTypeStore.LookupEntry(liquidData.Entry);
4432
4433 if (curLiquid != _lastLiquid)
4434 {
4437
4438 // Set _lastLiquid before casting liquid spell to avoid infinite loops
4439 _lastLiquid = curLiquid;
4440
4442 if (curLiquid && curLiquid->SpellId && (!player || !player->IsGameMaster()))
4443 CastSpell(this, curLiquid->SpellId, true);
4444 }
4445}
DBCStorage< LiquidTypeEntry > sLiquidTypeStore(LiquidTypefmt)
@ AURA_INTERRUPT_FLAG_NOT_ABOVEWATER
Definition SpellDefines.h:50
@ AURA_INTERRUPT_FLAG_NOT_UNDERWATER
Definition SpellDefines.h:51
void UpdateMovementFlags()
Definition Creature.cpp:3269
void RemoveAurasDueToSpell(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, uint8 reqEffMask=0, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
Definition Unit.cpp:5127
bool IsFlying() const
Definition Unit.h:1697
Definition GridTerrainData.h:199
float Level
Definition GridTerrainData.h:204
uint32 Entry
Definition GridTerrainData.h:202
Definition DBCStructure.h:1283
uint32 SpellId
Definition DBCStructure.h:1289

References _lastLiquid, AURA_INTERRUPT_FLAG_NOT_ABOVEWATER, AURA_INTERRUPT_FLAG_NOT_UNDERWATER, CastSpell(), LiquidData::Entry, GetCharmerOrOwnerPlayerOrPlayerItself(), GetCollisionHeight(), WorldObject::GetLiquidData(), Position::GetPositionZ(), IsControlledByPlayer(), Object::IsCreature(), IsFlying(), Player::IsGameMaster(), LiquidData::Level, MAP_LIQUID_STATUS_SWIMMING, RemoveAurasDueToSpell(), RemoveAurasWithInterruptFlags(), sLiquidTypeStore, LiquidTypeEntry::SpellId, LiquidData::Status, Object::ToCreature(), and Creature::UpdateMovementFlags().

Referenced by ProcessPositionDataChanged(), and Player::ProcessTerrainStatusUpdate().

◆ ProcSkillsAndAuras()

void Unit::ProcSkillsAndAuras ( Unit actor,
Unit victim,
uint32  procAttacker,
uint32  procVictim,
uint32  procEx,
uint32  amount,
WeaponAttackType  attType = BASE_ATTACK,
SpellInfo const *  procSpellInfo = nullptr,
SpellInfo const *  procAura = nullptr,
int8  procAuraEffectIndex = -1,
Spell const *  procSpell = nullptr,
DamageInfo damageInfo = nullptr,
HealInfo healInfo = nullptr,
uint32  procPhase = 2 
)
static
6711{
6712 // Handle skills and reactives for actor
6713 if (procAttacker && actor)
6714 actor->ProcSkillsAndReactives(false, victim, procAttacker, procExtra, attType, procSpellInfo, amount, procAura, procAuraEffectIndex, procSpell, damageInfo, healInfo, procPhase);
6715
6716 // Handle skills and reactives for victim
6717 if (victim && victim->IsAlive() && procVictim)
6718 victim->ProcSkillsAndReactives(true, actor, procVictim, procExtra, attType, procSpellInfo, amount, procAura, procAuraEffectIndex, procSpell, damageInfo, healInfo, procPhase);
6719
6720 // Handle aura procs via new proc system (TriggerAurasProcOnEvent)
6721 if (actor)
6722 {
6723 // Calculate spellTypeMask based on phase and actual damage/heal info
6725 if (procPhase == PROC_SPELL_PHASE_CAST || procPhase == PROC_SPELL_PHASE_FINISH)
6726 {
6727 // At CAST phase, no damage/heal has occurred yet - use MASK_ALL to allow
6728 // procs that check for damage/heal type based on spell info (like Backlash)
6729 // At FINISH phase, damageInfo may be null but spell did do damage - use MASK_ALL
6730 // to match TrinityCore behavior (see TC Spell.cpp PROC_SPELL_PHASE_FINISH call)
6732 }
6733 else if (healInfo && healInfo->GetHeal())
6735 else if (damageInfo && damageInfo->GetDamage())
6737 else if (procSpellInfo)
6739
6740 actor->TriggerAurasProcOnEvent(nullptr, nullptr, victim, procAttacker, procVictim, spellTypeMask, procPhase, procExtra, const_cast<Spell*>(procSpell), damageInfo, healInfo);
6741 }
6742}
static uint32 spellTypeMask[TOTAL_AURAS]
Definition SpellMgr.cpp:1776
@ PROC_SPELL_TYPE_HEAL
Definition SpellMgr.h:237
@ PROC_SPELL_TYPE_MASK_ALL
Definition SpellMgr.h:239
@ PROC_SPELL_TYPE_DAMAGE
Definition SpellMgr.h:236
@ PROC_SPELL_TYPE_NO_DMG_HEAL
Definition SpellMgr.h:238
@ PROC_SPELL_PHASE_FINISH
Definition SpellMgr.h:247
@ PROC_SPELL_PHASE_CAST
Definition SpellMgr.h:245
void TriggerAurasProcOnEvent(CalcDamageInfo &damageInfo)
Definition Unit.cpp:13030

References DamageInfo::GetDamage(), HealInfo::GetHeal(), IsAlive(), PROC_SPELL_PHASE_CAST, PROC_SPELL_PHASE_FINISH, PROC_SPELL_TYPE_DAMAGE, PROC_SPELL_TYPE_HEAL, PROC_SPELL_TYPE_MASK_ALL, PROC_SPELL_TYPE_NO_DMG_HEAL, ProcSkillsAndReactives(), spellTypeMask, and TriggerAurasProcOnEvent().

Referenced by Spell::_cast(), Spell::_handle_finish_phase(), AttackerStateUpdate(), Spell::DoAllEffectOnTarget(), ReflectEvent::Execute(), AuraEffect::HandlePeriodicDamageAurasTick(), AuraEffect::HandlePeriodicHealAurasTick(), AuraEffect::HandlePeriodicHealthLeechAuraTick(), AuraEffect::HandlePeriodicPowerBurnAuraTick(), and Kill().

◆ ProcSkillsAndReactives()

void Unit::ProcSkillsAndReactives ( bool  isVictim,
Unit target,
uint32  procFlag,
uint32  procExtra,
WeaponAttackType  attType,
SpellInfo const *  procSpellInfo,
uint32  damage,
SpellInfo const *  procAura = nullptr,
int8  procAuraEffectIndex = -1,
Spell const *  procSpell = nullptr,
DamageInfo damageInfo = nullptr,
HealInfo healInfo = nullptr,
uint32  procPhase = 2 
)
12905{
12906 // Player is loaded now - do not allow passive spell casts to proc
12907 if (IsPlayer() && ToPlayer()->GetSession()->PlayerLoading())
12908 return;
12909 // For melee/ranged based attack need update skills and set some Aura states if victim present
12910 if (procFlag & MELEE_BASED_TRIGGER_MASK && target && procPhase == PROC_SPELL_PHASE_HIT)
12911 {
12912 // Xinef: Shaman in ghost wolf form cant proc anything melee based
12913 if (!isVictim && GetShapeshiftForm() == FORM_GHOSTWOLF)
12914 return;
12915
12916 // Update skills here for players
12917 // only when you are not fighting other players or their pets/totems (pvp)
12918 if (IsPlayer() && !target->IsCharmedOwnedByPlayerOrPlayer())
12919 {
12920 // On melee based hit/miss/resist/parry/dodge need to update skill (for victim and attacker)
12922 {
12923 ToPlayer()->UpdateCombatSkills(target, attType, isVictim, procSpell ? procSpell->m_weaponItem : nullptr);
12924 }
12925 // Update defence if player is victim and we block - TODO: confirm that blocked attacks only have a chance to increase defence skill
12926 else if (isVictim && procExtra & (PROC_EX_BLOCK))
12927 {
12928 ToPlayer()->UpdateCombatSkills(target, attType, true);
12929 }
12930 }
12931 // If exist crit/parry/dodge/block need update aura state (for victim and attacker)
12933 {
12934 // for victim
12935 if (isVictim)
12936 {
12937 // if victim and dodge attack
12938 if (procExtra & PROC_EX_DODGE)
12939 {
12940 // Update AURA_STATE on dodge
12941 if (!IsClass(CLASS_ROGUE, CLASS_CONTEXT_ABILITY_REACTIVE)) // skip Rogue Riposte
12942 {
12945 }
12946 }
12947 // if victim and parry attack
12948 if (procExtra & PROC_EX_PARRY)
12949 {
12950 // For Hunters only Counterattack (skip Mongoose bite)
12952 {
12955 }
12956 else
12957 {
12960 }
12961 }
12962 // if and victim block attack
12963 if (procExtra & PROC_EX_BLOCK)
12964 {
12967 }
12968 }
12969 else // For attacker
12970 {
12971 // Overpower on victim dodge
12972 if (procExtra & PROC_EX_DODGE)
12973 {
12975 {
12976 AddComboPoints(target, 1);
12978 }
12979 }
12980
12981 // Wolverine Bite
12982 if ((procExtra & PROC_HIT_CRITICAL) && IsHunterPet())
12983 {
12984 AddComboPoints(target, 1);
12986 }
12987 }
12988 }
12989 }
12990 // Aura procs are now handled by TriggerAurasProcOnEvent called from ProcSkillsAndAuras
12991}
@ CLASS_ROGUE
Definition SharedDefines.h:144
@ PROC_HIT_CRITICAL
Definition SpellMgr.h:255
#define MELEE_BASED_TRIGGER_MASK
Definition SpellMgr.h:184
@ PROC_EX_DODGE
Definition SpellMgr.h:200
@ PROC_EX_BLOCK
Definition SpellMgr.h:202
@ PROC_EX_CRITICAL_HIT
Definition SpellMgr.h:197
@ PROC_EX_NORMAL_HIT
Definition SpellMgr.h:196
@ PROC_EX_MISS
Definition SpellMgr.h:198
@ PROC_EX_RESIST
Definition SpellMgr.h:199
@ PROC_EX_PARRY
Definition SpellMgr.h:201
@ PROC_SPELL_PHASE_HIT
Definition SpellMgr.h:246
@ REACTIVE_OVERPOWER
Definition Unit.h:615
@ REACTIVE_DEFENSE
Definition Unit.h:613
@ REACTIVE_HUNTER_PARRY
Definition Unit.h:614
@ REACTIVE_WOLVERINE_BITE
Definition Unit.h:616
void UpdateCombatSkills(Unit *victim, WeaponAttackType attType, bool defence, Item *item=nullptr)
Definition PlayerUpdates.cpp:1031
bool IsHunterPet() const
Definition Unit.h:792
void StartReactiveTimer(ReactiveType reactive)
Definition Unit.h:1838

References AddComboPoints(), AURA_STATE_DEFENSE, AURA_STATE_HUNTER_PARRY, CLASS_CONTEXT_ABILITY_REACTIVE, CLASS_HUNTER, CLASS_ROGUE, CLASS_WARRIOR, FORM_GHOSTWOLF, GetShapeshiftForm(), IsCharmedOwnedByPlayerOrPlayer(), IsClass(), IsHunterPet(), Object::IsPlayer(), Spell::m_weaponItem, MELEE_BASED_TRIGGER_MASK, ModifyAuraState(), PROC_EX_BLOCK, PROC_EX_CRITICAL_HIT, PROC_EX_DODGE, PROC_EX_MISS, PROC_EX_NORMAL_HIT, PROC_EX_PARRY, PROC_EX_RESIST, PROC_HIT_CRITICAL, PROC_SPELL_PHASE_HIT, REACTIVE_DEFENSE, REACTIVE_HUNTER_PARRY, REACTIVE_OVERPOWER, REACTIVE_WOLVERINE_BITE, StartReactiveTimer(), Object::ToPlayer(), and Player::UpdateCombatSkills().

Referenced by CalcAbsorbResist(), and ProcSkillsAndAuras().

◆ ProhibitSpellSchool()

virtual void Unit::ProhibitSpellSchool ( SpellSchoolMask  ,
uint32   
)
inlinevirtual

Reimplemented in Creature, and Player.

1573{ }

Referenced by Spell::EffectInterruptCast().

◆ propagateSpeedChange()

void Unit::propagateSpeedChange ( )
inline
void propagateSpeedChange()
Definition MotionMaster.cpp:926

References GetMotionMaster(), and MotionMaster::propagateSpeedChange().

Referenced by SetSpeed(), and SetWalk().

◆ RecalculateObjectScale()

void Unit::RecalculateObjectScale ( )
virtual
13257{
13259 float scale = GetNativeObjectScale() + CalculatePct(1.0f, scaleAuras);
13260 float scaleMin = IsPlayer() ? 0.1f : 0.01f;
13261 SetObjectScale(std::max(scale, scaleMin));
13262}
@ SPELL_AURA_MOD_SCALE_2
Definition SpellAuraDefines.h:302
@ SPELL_AURA_MOD_SCALE
Definition SpellAuraDefines.h:124
virtual void SetObjectScale(float scale)
Definition Object.h:120
virtual float GetNativeObjectScale() const
Definition Unit.h:1955

References CalculatePct(), GetNativeObjectScale(), GetTotalAuraModifier(), Object::IsPlayer(), Object::SetObjectScale(), SPELL_AURA_MOD_SCALE, and SPELL_AURA_MOD_SCALE_2.

Referenced by AuraEffect::HandleAuraModScale().

◆ RemoveAllAttackers()

void Unit::RemoveAllAttackers ( )

Remove all units in m_attackers list and send them AttackStop()

7474{
7475 while (!m_attackers.empty())
7476 {
7477 AttackerSet::iterator iter = m_attackers.begin();
7478 if (!(*iter)->AttackStop())
7479 {
7480 LOG_ERROR("entities.unit", "WORLD: Unit has an attacker that isn't attacking it!");
7481 m_attackers.erase(iter);
7482 }
7483 }
7484}

References LOG_ERROR, and m_attackers.

Referenced by CombatStop(), Spell::EffectSanctuary(), boss_kaelthas::ExecuteMiddleEvent(), AuraEffect::HandleFeignDeath(), boss_kelthuzad::boss_kelthuzadAI::JustEngagedWith(), spell_halion_twilight_phasing_aura::OnApply(), spell_halion_twilight_phasing_aura::OnRemove(), boss_attumen::SpellHit(), and npc_qiraj_war_spawn::npc_qiraj_war_spawnAI::UpdateAI().

◆ RemoveAllAuras()

void Unit::RemoveAllAuras ( )
5545{
5546 // this may be a dead loop if some events on aura remove will continiously apply aura on remove
5547 // we want to have all auras removed, so use your brain when linking events
5548 while (!m_appliedAuras.empty() || !m_ownedAuras.empty())
5549 {
5550 AuraApplicationMap::iterator aurAppIter;
5551 for (aurAppIter = m_appliedAuras.begin(); aurAppIter != m_appliedAuras.end();)
5553
5554 AuraMap::iterator aurIter;
5555 for (aurIter = m_ownedAuras.begin(); aurIter != m_ownedAuras.end();)
5556 RemoveOwnedAura(aurIter);
5557 }
5558}

References _UnapplyAura(), AURA_REMOVE_BY_DEFAULT, m_appliedAuras, m_ownedAuras, and RemoveOwnedAura().

Referenced by CleanupBeforeRemoveFromMap(), boss_muru::DamageTaken(), boss_headless_horseman_head::DamageTaken(), boss_black_knight::boss_black_knightAI::DamageTaken(), boss_grand_champion::boss_grand_championAI::DamageTaken(), boss_freya::DamageTaken(), boss_hodir::DamageTaken(), boss_ingvar_the_plunderer::DamageTaken(), npc_vrykul_skeleton::DamageTaken(), npc_overlord_drakuru_betrayal::DamageTaken(), npc_magister_aledis::DamageTaken(), npc_tapoke_slim_jahn::npc_tapoke_slim_jahnAI::DamageTaken(), npc_molten_golem::DamageTaken(), npc_death_knight_initiate::npc_death_knight_initiateAI::DamageTaken(), boss_thorim::DamageTaken(), spell_rotface_unstable_ooze_explosion_suicide_aura::DespawnSelf(), npc_icc_ice_sphere::npc_icc_ice_sphereAI::DoAction(), boss_taldaram::DoAction(), npc_strangulate_vehicle::npc_strangulate_vehicleAI::DoAction(), boss_leotheras_the_blind::DoAction(), boss_kalecgos::DoAction(), boss_grand_champion::boss_grand_championAI::DoAction(), npc_anubarak_spike::npc_anubarak_spikeAI::DoAction(), boss_tyrannus::boss_tyrannusAI::DoAction(), boss_kelthuzad_minion::boss_kelthuzad_minionAI::DoAction(), npc_spark_of_ionar::DoAction(), boss_yoggsaron_sara::DoAction(), boss_yoggsaron_cloud::DoAction(), npc_taretha::npc_tarethaAI::DoAction(), boss_razorgore::boss_razorgoreAI::DoChangePhase(), npc_taskmaster_fizzule::npc_taskmaster_fizzuleAI::DoFriend(), npc_unkor_the_ruthless::npc_unkor_the_ruthlessAI::DoNice(), boss_mimiron::EnterEvadeMode(), npc_ulduar_leviathan_mkii::EnterEvadeMode(), npc_ulduar_vx001::EnterEvadeMode(), npc_ulduar_aerial_command_unit::EnterEvadeMode(), GuardAI::EnterEvadeMode(), boss_doomrel::boss_doomrelAI::EnterEvadeMode(), FollowerAI::EnterEvadeMode(), npc_crystalline_frayer::EnterSeedPod(), LichKingDeathEvent::Execute(), spell_herald_volzaj_insanity::HandleDummyEffect(), misc_commandscript::HandleUnAuraCommand(), boss_ick::boss_ickAI::JustDied(), boss_venoxis::JustDied(), boss_taldaram::JustEngagedWith(), boss_mimiron::JustEngagedWith(), boss_high_botanist_freywinn::JustEngagedWith(), boss_novos::JustEngagedWith(), boss_professor_putricide::boss_professor_putricideAI::JustEngagedWith(), boss_commander_stoutbeard::JustEngagedWith(), boss_high_astromancer_solarian::JustEngagedWith(), boss_steelbreaker::JustReachedHome(), boss_runemaster_molgeim::JustReachedHome(), boss_stormcaller_brundir::JustReachedHome(), boss_urom::boss_uromAI::LeaveCombat(), boss_taldaram::MovementInform(), npc_hallows_end_soh::MovementInform(), npc_injured_7th_legion_soldier::npc_injured_7th_legion_soldierAI::MovementInform(), spell_kaelthas_flame_strike::OnRemove(), PretendToDie(), boss_alar::PretendToDie(), Creature::RemoveCorpse(), boss_venoxis::Reset(), npc_the_lich_king_controller::npc_the_lich_king_controllerAI::Reset(), boss_thaddius::boss_thaddiusAI::Reset(), npc_crystalline_frayer::Reset(), boss_bjarngrim::Reset(), boss_loken::Reset(), boss_hodir::Reset(), boss_xt002::Reset(), boss_skadi_grauf::boss_skadi_graufAI::Reset(), npc_q24545_lich_king::npc_q24545_lich_kingAI::Reset(), Pet::SavePetToDB(), npc_anubarak_spike::npc_anubarak_spikeAI::SelectNewTarget(), npc_harrison_jones::SpellHit(), npc_frost_sphere::npc_frost_sphereAI::SpellHit(), npc_tirion_fordring_tft::npc_tirion_fordringAI::SpellHit(), npc_ulduar_flames_spread::SpellHit(), npc_soh_fire_trigger::SpellHit(), npc_hallows_end_train_fire::SpellHit(), boss_headless_horseman_head::SpellHit(), npc_vaelastrasz_the_red::npc_vaelastrasz_the_redAI::UpdateAI(), npc_highlord_darion_mograine::npc_highlord_darion_mograineAI::UpdateAI(), npc_madrigosa::UpdateAI(), npc_snobold_vassal::npc_snobold_vassalAI::UpdateAI(), boss_krick::boss_krickAI::UpdateAI(), npc_kinetic_bomb::npc_kinetic_bombAI::UpdateAI(), npc_tirion_fordring_tft::npc_tirion_fordringAI::UpdateAI(), npc_lk_spirit_bomb::npc_lk_spirit_bombAI::UpdateAI(), npc_icc_putricades_trap::npc_icc_putricades_trapAI::UpdateAI(), boss_gothik::boss_gothikAI::UpdateAI(), boss_thaddius::boss_thaddiusAI::UpdateAI(), boss_malygos::UpdateAI(), boss_magus_telestra::UpdateAI(), boss_algalon_the_observer::UpdateAI(), boss_svala::boss_svalaAI::UpdateAI(), npc_q24545_lich_king::npc_q24545_lich_kingAI::UpdateAI(), npc_iron_watcher::npc_iron_watcherAI::UpdateAI(), and npc_aeranas::npc_aeranasAI::UpdateAI().

◆ RemoveAllAurasExceptType()

void Unit::RemoveAllAurasExceptType ( AuraType  type)
5619{
5620 for (AuraApplicationMap::iterator iter = m_appliedAuras.begin(); iter != m_appliedAuras.end();)
5621 {
5622 Aura const* aura = iter->second->GetBase();
5623 if (aura->GetSpellInfo()->HasAura(type))
5624 ++iter;
5625 else
5627 }
5628
5629 for (AuraMap::iterator iter = m_ownedAuras.begin(); iter != m_ownedAuras.end();)
5630 {
5631 Aura* aura = iter->second;
5632 if (aura->GetSpellInfo()->HasAura(type))
5633 ++iter;
5634 else
5636 }
5637}

References _UnapplyAura(), AURA_REMOVE_BY_DEFAULT, Aura::GetSpellInfo(), SpellInfo::HasAura(), m_appliedAuras, m_ownedAuras, and RemoveOwnedAura().

Referenced by npc_ulduar_leviathan_mkii::DamageTaken(), npc_ulduar_vx001::DamageTaken(), npc_ulduar_aerial_command_unit::DamageTaken(), spell_q11919_q11940_drake_hunt_aura::HandleEffectRemove(), and npc_iron_watcher::npc_iron_watcherAI::SpellHit().

◆ RemoveAllAurasOnDeath()

void Unit::RemoveAllAurasOnDeath ( )
5575{
5576 // used just after dieing to remove all visible auras
5577 // and disable the mods for the passive ones
5578 for (AuraApplicationMap::iterator iter = m_appliedAuras.begin(); iter != m_appliedAuras.end();)
5579 {
5580 Aura const* aura = iter->second->GetBase();
5583 else
5584 ++iter;
5585 }
5586
5587 for (AuraMap::iterator iter = m_ownedAuras.begin(); iter != m_ownedAuras.end();)
5588 {
5589 Aura* aura = iter->second;
5592 else
5593 ++iter;
5594 }
5595}
@ SPELL_ATTR7_DISABLE_AURA_WHILE_DEAD
Definition SharedDefines.h:654
@ AURA_REMOVE_BY_DEATH
Definition SpellAuraDefines.h:396
bool IsDeathPersistent() const
Definition SpellAuras.cpp:1033

References _UnapplyAura(), AURA_REMOVE_BY_DEATH, Aura::GetSpellInfo(), SpellInfo::HasAttribute(), Aura::IsDeathPersistent(), Aura::IsPassive(), m_appliedAuras, m_ownedAuras, RemoveOwnedAura(), and SPELL_ATTR7_DISABLE_AURA_WHILE_DEAD.

Referenced by spell_dk_death_pact::FilterTargets(), Kill(), Player::LoadFromDB(), and setDeathState().

◆ RemoveAllAurasRequiringDeadTarget()

void Unit::RemoveAllAurasRequiringDeadTarget ( )
5598{
5599 for (AuraApplicationMap::iterator iter = m_appliedAuras.begin(); iter != m_appliedAuras.end();)
5600 {
5601 Aura const* aura = iter->second->GetBase();
5602 if (!aura->IsPassive() && aura->GetSpellInfo()->IsRequiringDeadTarget())
5604 else
5605 ++iter;
5606 }
5607
5608 for (AuraMap::iterator iter = m_ownedAuras.begin(); iter != m_ownedAuras.end();)
5609 {
5610 Aura* aura = iter->second;
5611 if (!aura->IsPassive() && aura->GetSpellInfo()->IsRequiringDeadTarget())
5613 else
5614 ++iter;
5615 }
5616}
bool IsRequiringDeadTarget() const
Definition SpellInfo.cpp:1222

References _UnapplyAura(), AURA_REMOVE_BY_DEFAULT, Aura::GetSpellInfo(), Aura::IsPassive(), SpellInfo::IsRequiringDeadTarget(), m_appliedAuras, m_ownedAuras, and RemoveOwnedAura().

Referenced by Player::LoadFromDB().

◆ RemoveAllControlled()

void Unit::RemoveAllControlled ( bool  onDeath = false)
8082{
8083 // possessed pet and vehicle
8084 if (IsPlayer())
8086
8087 while (!m_Controlled.empty())
8088 {
8089 Unit* target = *m_Controlled.begin();
8090 m_Controlled.erase(m_Controlled.begin());
8091 if (target->GetCharmerGUID() == GetGUID())
8092 {
8093 target->RemoveCharmAuras();
8094 }
8095 else if (target->GetOwnerGUID() == GetGUID() && target->IsSummon())
8096 {
8097 if (!(onDeath && !IsPlayer() && target->IsGuardian()))
8098 {
8099 target->ToTempSummon()->UnSummon();
8100 }
8101 }
8102 else
8103 {
8104 LOG_ERROR("entities.unit", "Unit {} is trying to release unit {} which is neither charmed nor owned by it", GetEntry(), target->GetEntry());
8105 }
8106 }
8107}
void StopCastingCharm(Aura *except=nullptr)
Definition Player.cpp:9327
bool IsGuardian() const
Definition Unit.h:789
void RemoveCharmAuras()
Definition Unit.cpp:8189

References GetCharmerGUID(), Object::GetEntry(), Object::GetGUID(), GetOwnerGUID(), IsGuardian(), Object::IsPlayer(), IsSummon(), LOG_ERROR, m_Controlled, RemoveCharmAuras(), Player::StopCastingCharm(), Object::ToPlayer(), ToTempSummon(), and TempSummon::UnSummon().

Referenced by Player::ActivateSpec(), RemoveFromWorld(), and setDeathState().

◆ RemoveAllDynObjects()

void Unit::RemoveAllDynObjects ( )
6497{
6498 while (!m_dynObj.empty())
6499 m_dynObj.front()->Remove();
6500}

References m_dynObj.

Referenced by RemoveFromWorld(), Player::TeleportTo(), and npc_icc_putricades_trap::npc_icc_putricades_trapAI::UpdateAI().

◆ RemoveAllGameObjects()

void Unit::RemoveAllGameObjects ( )
6597{
6598 while(!m_gameObj.empty())
6599 {
6600 GameObject* go = ObjectAccessor::GetGameObject(*this, *m_gameObj.begin());
6601 if (go)
6602 {
6604 go->SetRespawnTime(0);
6605 go->Delete();
6606 }
6607 m_gameObj.erase(m_gameObj.begin());
6608 }
6609}
void Delete()
Definition GameObject.cpp:973
void SetRespawnTime(int32 respawn)
Definition GameObject.cpp:1279

References GameObject::Delete(), ObjectGuid::Empty, ObjectAccessor::GetGameObject(), m_gameObj, GameObject::SetOwnerGUID(), and GameObject::SetRespawnTime().

Referenced by CleanupBeforeRemoveFromMap(), npc_ice_tomb::npc_ice_tombAI::JustDied(), RemoveFromWorld(), npc_brewfest_super_brew_trigger::UpdateAI(), and boss_sapphiron::boss_sapphironAI::UpdateAI().

◆ RemoveAllMinionsByEntry()

void Unit::RemoveAllMinionsByEntry ( uint32  entry)
7853{
7854 for (Unit::ControlSet::iterator itr = m_Controlled.begin(); itr != m_Controlled.end();)
7855 {
7856 Unit* unit = *itr;
7857 ++itr;
7858 if (unit->GetEntry() == entry && unit->IsCreature()
7859 && unit->ToCreature()->IsSummon()) // minion, actually
7860 unit->ToTempSummon()->UnSummon();
7861 // i think this is safe because i have never heard that a despawned minion will trigger a same minion
7862 }
7863}

References Object::GetEntry(), Object::IsCreature(), IsSummon(), m_Controlled, Object::ToCreature(), ToTempSummon(), and TempSummon::UnSummon().

Referenced by Spell::EffectSummonType(), npc_nelson::npc_nelsonAI::Reset(), SetMinion(), and npc_nelson::npc_nelsonAI::UpdateAI().

◆ RemoveAppliedAuras() [1/2]

void Unit::RemoveAppliedAuras ( std::function< bool(AuraApplication const *)> const &  check)
5089{
5090 for (AuraApplicationMap::iterator iter = m_appliedAuras.begin(); iter != m_appliedAuras.end();)
5091 {
5092 if (check(iter->second))
5093 {
5094 RemoveAura(iter);
5095 continue;
5096 }
5097 ++iter;
5098 }
5099}

References m_appliedAuras, and RemoveAura().

Referenced by _RemoveNoStackAurasDueToAura(), and RemoveArenaAuras().

◆ RemoveAppliedAuras() [2/2]

void Unit::RemoveAppliedAuras ( uint32  spellId,
std::function< bool(AuraApplication const *)> const &  check 
)
5115{
5116 for (AuraApplicationMap::iterator iter = m_appliedAuras.lower_bound(spellId); iter != m_appliedAuras.upper_bound(spellId);)
5117 {
5118 if (check(iter->second))
5119 {
5120 RemoveAura(iter);
5121 continue;
5122 }
5123 ++iter;
5124 }
5125}

References m_appliedAuras, and RemoveAura().

◆ RemoveAreaAurasDueToLeaveWorld()

void Unit::RemoveAreaAurasDueToLeaveWorld ( )
5512{
5513 // make sure that all area auras not applied on self are removed - prevent access to deleted pointer later
5514 for (AuraMap::iterator iter = m_ownedAuras.begin(); iter != m_ownedAuras.end();)
5515 {
5516 Aura* aura = iter->second;
5517 ++iter;
5518 Aura::ApplicationMap const& appMap = aura->GetApplicationMap();
5519 for (Aura::ApplicationMap::const_iterator itr = appMap.begin(); itr != appMap.end();)
5520 {
5521 AuraApplication* aurApp = itr->second;
5522 ++itr;
5523 Unit* target = aurApp->GetTarget();
5524 if (target == this)
5525 continue;
5526 target->RemoveAura(aurApp);
5527 // things linked on aura remove may apply new area aura - so start from the beginning
5528 iter = m_ownedAuras.begin();
5529 }
5530 }
5531
5532 // remove area auras owned by others
5533 for (AuraApplicationMap::iterator iter = m_appliedAuras.begin(); iter != m_appliedAuras.end();)
5534 {
5535 if (iter->second->GetBase()->GetOwner() != this)
5536 {
5537 RemoveAura(iter);
5538 }
5539 else
5540 ++iter;
5541 }
5542}
ApplicationMap const & GetApplicationMap()
Definition SpellAuras.h:182
std::map< ObjectGuid, AuraApplication * > ApplicationMap
Definition SpellAuras.h:90

References Aura::GetApplicationMap(), AuraApplication::GetTarget(), m_appliedAuras, m_ownedAuras, and RemoveAura().

Referenced by RemoveFromWorld().

◆ RemoveArenaAuras()

void Unit::RemoveArenaAuras ( )
5561{
5562 // in join, remove positive buffs, on end, remove negative
5563 // used to remove positive visible auras in arenas
5564 RemoveAppliedAuras([](AuraApplication const* aurApp)
5565 {
5566 Aura const* aura = aurApp->GetBase();
5567 return (!aura->GetSpellInfo()->HasAttribute(SPELL_ATTR4_ALLOW_ENETRING_ARENA) // don't remove stances, shadowform, pally/hunter auras
5568 && !aura->IsPassive() // don't remove passive auras
5569 && (aurApp->IsPositive() || !aura->GetSpellInfo()->HasAttribute(SPELL_ATTR3_ALLOW_AURA_WHILE_DEAD))) || // not negative death persistent auras
5570 aura->GetSpellInfo()->HasAttribute(SPELL_ATTR5_REMOVE_ENTERING_ARENA); // special marker, always remove
5571 });
5572}
@ SPELL_ATTR5_REMOVE_ENTERING_ARENA
Definition SharedDefines.h:580
@ SPELL_ATTR3_ALLOW_AURA_WHILE_DEAD
Definition SharedDefines.h:524
@ SPELL_ATTR4_ALLOW_ENETRING_ARENA
Definition SharedDefines.h:562
bool IsPositive() const
Definition SpellAuras.h:68

References AuraApplication::GetBase(), Aura::GetSpellInfo(), SpellInfo::HasAttribute(), Aura::IsPassive(), AuraApplication::IsPositive(), RemoveAppliedAuras(), SPELL_ATTR3_ALLOW_AURA_WHILE_DEAD, SPELL_ATTR4_ALLOW_ENETRING_ARENA, and SPELL_ATTR5_REMOVE_ENTERING_ARENA.

Referenced by Battleground::AddPlayer().

◆ RemoveAura() [1/4]

void Unit::RemoveAura ( Aura aur,
AuraRemoveMode  mode = AURA_REMOVE_BY_DEFAULT 
)
5068{
5069 if (aura->IsRemoved())
5070 return;
5071 if (AuraApplication* aurApp = aura->GetApplicationOfTarget(GetGUID()))
5072 RemoveAura(aurApp, mode);
5073}

References Aura::GetApplicationOfTarget(), Object::GetGUID(), Aura::IsRemoved(), and RemoveAura().

◆ RemoveAura() [2/4]

void Unit::RemoveAura ( AuraApplication aurApp,
AuraRemoveMode  mode = AURA_REMOVE_BY_DEFAULT 
)
5025{
5026 // we've special situation here, RemoveAura called while during aura removal
5027 // this kind of call is needed only when aura effect removal handler
5028 // or event triggered by it expects to remove
5029 // not yet removed effects of an aura
5030 if (aurApp->GetRemoveMode())
5031 {
5032 // remove remaining effects of an aura
5033 for (uint8 itr = 0; itr < MAX_SPELL_EFFECTS; ++itr)
5034 {
5035 if (aurApp->HasEffect(itr))
5036 aurApp->_HandleEffect(itr, false);
5037 }
5038 return;
5039 }
5040 // no need to remove
5041 if (aurApp->GetBase()->GetApplicationOfTarget(GetGUID()) != aurApp || aurApp->GetBase()->IsRemoved())
5042 return;
5043
5044 uint32 spellId = aurApp->GetBase()->GetId();
5045 AuraApplicationMapBoundsNonConst range = m_appliedAuras.equal_range(spellId);
5046
5047 for (AuraApplicationMap::iterator iter = range.first; iter != range.second;)
5048 {
5049 if (aurApp == iter->second)
5050 {
5051 // Prevent Arena Preparation aura from being removed by player actions
5052 // It's an invisibility spell so any interaction/spell cast etc. removes it.
5053 // Should only be removed by the arena script, once the match starts.
5055 {
5056 return;
5057 }
5058
5059 RemoveAura(iter, mode);
5060 return;
5061 }
5062 else
5063 ++iter;
5064 }
5065}
@ SPELL_AURA_ARENA_PREPARATION
Definition SpellAuraDefines.h:278

References AuraApplication::_HandleEffect(), Aura::GetApplicationOfTarget(), AuraApplication::GetBase(), Object::GetGUID(), Aura::GetId(), AuraApplication::GetRemoveMode(), AuraApplication::HasEffect(), Aura::HasEffectType(), Aura::IsRemoved(), m_appliedAuras, MAX_SPELL_EFFECTS, RemoveAura(), and SPELL_AURA_ARENA_PREPARATION.

◆ RemoveAura() [3/4]

void Unit::RemoveAura ( AuraApplicationMap::iterator &  i,
AuraRemoveMode  mode = AURA_REMOVE_BY_DEFAULT 
)
4995{
4996 AuraApplication* aurApp = i->second;
4997 // Do not remove aura which is already being removed
4998 if (aurApp->GetRemoveMode())
4999 return;
5000 Aura* aura = aurApp->GetBase();
5001 _UnapplyAura(i, mode);
5002 // Remove aura - for Area and Target auras
5003 if (aura->GetOwner() == this)
5004 aura->Remove(mode);
5005}

References _UnapplyAura(), AuraApplication::GetBase(), Aura::GetOwner(), AuraApplication::GetRemoveMode(), and Aura::Remove().

Referenced by boss_marli::_schedulePhaseTroll(), ApplySpellDispelImmunity(), Player::CheckAreaExploreAndOutdoor(), boss_headless_horseman::DamageTaken(), npc_power_spark::DamageTaken(), boss_viscidus::DamageTaken(), boss_thorim::DamageTaken(), npc_hor_lich_king::npc_hor_lich_kingAI::DoAction(), boss_victor_nefarius::boss_victor_nefariusAI::DoAction(), npc_harrison_jones::DoAction(), brann_bronzebeard::brann_bronzebeardAI::DoAction(), npc_pilgrims_bounty_chair::DoAction(), boss_paletress::boss_paletressAI::DoAction(), boss_vezax::DoAction(), boss_yoggsaron::DoAction(), boss_yoggsaron_crusher_tentacle::DoAction(), boss_yoggsaron_corruptor_tentacle::DoAction(), boss_yoggsaron_constrictor_tentacle::DoAction(), boss_ichoron::boss_ichoronAI::DoExplodeCompleted(), Player::DuelComplete(), Spell::EffectDispelMechanic(), Spell::EffectForceCast(), Spell::EffectHeal(), Spell::EffectSummonPet(), Spell::EffectTriggerSpell(), npc_thrall_bfu::npc_thrall_bfuAI::EnterEvadeMode(), Spell::finish(), GetDiseasesByCaster(), AuraEffect::HandleAuraLinked(), AuraEffect::HandleAuraModSchoolImmunity(), Aura::HandleAuraSpecificMods(), AuraEffect::HandleBreakableCCAuraProc(), deserter_commandscript::HandleDeserterRemove(), deserter_commandscript::HandleDeserterRemoveAll(), spell_valanar_kinetic_bomb_aura::HandleDummyTick(), spell_warl_demonic_circle_summon::HandleDummyTick(), spell_bloodspore_haze::HandleEffectHit(), spell_midsummer_ribbon_pole::HandleEffectPeriodic(), spell_dk_improved_blood_presence::HandleEffectRemove(), spell_dk_improved_frost_presence::HandleEffectRemove(), spell_dk_improved_unholy_presence::HandleEffectRemove(), spell_dk_presence::HandleEffectRemove(), spell_pal_blessing_of_sanctuary::HandleEffectRemove(), spell_sha_chain_heal::HandleHeal(), spell_sindragosa_frost_breath::HandleInfusion(), spell_warl_demonic_circle_summon::HandleRemove(), spell_putricide_eat_ooze::HandleScript(), spell_handover_reins::HandleScriptEffect(), AuraEffect::HandleShapeshiftBoosts(), IsHighestExclusiveAuraEffect(), npc_zulian_prowler::npc_zulian_prowlerAI::JustEngagedWith(), boss_jaraxxus::boss_jaraxxusAI::JustEngagedWith(), npc_pos_deathwhisper_necrolyte::npc_pos_deathwhisper_necrolyteAI::JustEngagedWith(), npc_ulduar_snow_mound::MoveInLineOfSight(), boss_loken::OnAuraRemove(), spell_blood_queen_vampiric_bite::OnCast(), npc_toc5_player_vehicle::npc_toc5_player_vehicleAI::OnCharmed(), npc_essence_of_twin::OnGossipHello(), spell_love_is_in_the_air_romantic_picnic::OnPeriodic(), spell_yogg_saron_empowered_aura::OnPeriodic(), npc_thrall_bfu::OnQuestReward(), spell_malygos_vortex_visual::OnRemove(), npc_toc5_player_vehicle::npc_toc5_player_vehicleAI::PassengerBoarded(), npc_eastvale_peasent::PathEndReached(), BattlefieldWG::PromotePlayer(), RemoveAppliedAuras(), RemoveAppliedAuras(), RemoveAreaAurasDueToLeaveWorld(), RemoveAura(), RemoveAura(), RemoveAura(), RemoveAurasByShapeShift(), RemoveAurasByType(), RemoveAurasDueToItemSpell(), RemoveAurasDueToSpell(), RemoveAurasWithAttribute(), RemoveAurasWithFamily(), RemoveAurasWithInterruptFlags(), RemoveAurasWithMechanic(), RemoveMovementImpairingAuras(), BattlegroundIC::RemovePlayer(), BattlegroundMap::RemovePlayerFromMap(), boss_bjarngrim::RemoveStanceAura(), boss_gyth::boss_gythAI::Reset(), boss_pyroguard_emberseer::boss_pyroguard_emberseerAI::Reset(), boss_victor_nefarius::boss_victor_nefariusAI::Reset(), boss_marli::Reset(), boss_garfrost::boss_garfrostAI::Reset(), boss_varos::boss_varosAI::Reset(), NPCStaveQuestAI::ResetState(), boss_sartharion::SendLavaWaves(), boss_anomalus::SetData(), boss_hodir::SmallIcicles(), boss_malygos::SpellHit(), npc_ulduar_iron_construct::SpellHit(), npc_nelson::npc_nelsonAI::SpellHit(), boss_headless_horseman::SpellHit(), boss_viscidus::SpellHit(), spell_pal_hand_of_sacrifice_aura::Split(), boss_sartharion_shadron::SummonedCreatureDies(), boss_pyroguard_emberseer::boss_pyroguard_emberseerAI::UpdateAI(), boss_kirtonos_the_herald::boss_kirtonos_the_heraldAI::UpdateAI(), boss_arlokk::boss_arlokkAI::UpdateAI(), boss_headless_horseman::UpdateAI(), npc_onyxian_lair_guard::UpdateAI(), boss_viscidus::UpdateAI(), boss_anubarak_trial::boss_anubarak_trialAI::UpdateAI(), npc_nerubian_burrower::npc_nerubian_burrowerAI::UpdateAI(), npc_snobold_vassal::npc_snobold_vassalAI::UpdateAI(), npc_hor_leader_second::npc_hor_leader_secondAI::UpdateAI(), npc_pos_leader::npc_pos_leaderAI::UpdateAI(), boss_kelthuzad::boss_kelthuzadAI::UpdateAI(), boss_stormcaller_brundir::UpdateAI(), npc_thorims_hammer::UpdateAI(), boss_freya::UpdateAI(), boss_freya_elder_brightleaf::UpdateAI(), npc_ulduar_iron_construct::UpdateAI(), npc_ulduar_aerial_command_unit::UpdateAI(), boss_razorscale::UpdateAI(), boss_yoggsaron_sara::UpdateAI(), boss_ingvar_the_plunderer::UpdateAI(), Spell::UpdateChanneledTargetList(), and boss_bjarngrim::WaypointReached().

◆ RemoveAura() [4/4]

void Unit::RemoveAura ( uint32  spellId,
ObjectGuid  casterGUID = ObjectGuid::Empty,
uint8  reqEffMask = 0,
AuraRemoveMode  removeMode = AURA_REMOVE_BY_DEFAULT 
)
5008{
5009 AuraApplicationMapBoundsNonConst range = m_appliedAuras.equal_range(spellId);
5010 for (AuraApplicationMap::iterator iter = range.first; iter != range.second;)
5011 {
5012 Aura const* aura = iter->second->GetBase();
5013 if (((aura->GetEffectMask() & reqEffMask) == reqEffMask)
5014 && (!caster || aura->GetCasterGUID() == caster))
5015 {
5016 RemoveAura(iter, removeMode);
5017 return;
5018 }
5019 else
5020 ++iter;
5021 }
5022}

References Aura::GetCasterGUID(), Aura::GetEffectMask(), m_appliedAuras, and RemoveAura().

◆ RemoveAuraFromStack()

void Unit::RemoveAuraFromStack ( uint32  spellId,
ObjectGuid  casterGUID = ObjectGuid::Empty,
AuraRemoveMode  removeMode = AURA_REMOVE_BY_DEFAULT 
)
5144{
5145 AuraMapBoundsNonConst range = m_ownedAuras.equal_range(spellId);
5146 for (AuraMap::iterator iter = range.first; iter != range.second;)
5147 {
5148 Aura* aura = iter->second;
5149 if ((aura->GetType() == UNIT_AURA_TYPE)
5150 && (!casterGUID || aura->GetCasterGUID() == casterGUID))
5151 {
5152 aura->ModStackAmount(-1, removeMode);
5153 return;
5154 }
5155 else
5156 ++iter;
5157 }
5158}
@ UNIT_AURA_TYPE
Definition SpellAuraDefines.h:385
bool ModStackAmount(int32 num, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT, bool periodicReset=false)
Definition SpellAuras.cpp:963
AuraObjectType GetType() const
Definition SpellAuras.cpp:420

References Aura::GetCasterGUID(), Aura::GetType(), m_ownedAuras, Aura::ModStackAmount(), and UNIT_AURA_TYPE.

Referenced by Spell::EffectSchoolDMG(), spell_putricide_gaseous_bloat_aura::HandleExtraEffect(), spell_oculus_evasive_maneuvers_aura::HandleProc(), spell_sha_tidal_force_dummy::HandleProc(), spell_dk_scent_of_blood::HandleProc(), spell_item_restless_strength::HandleProc(), spell_item_unstable_power::HandleProc(), spell_item_brittle_armor::HandleScript(), spell_item_mercurial_shield::HandleScript(), spell_item_deadly_precision::HandleStackDrop(), boss_selin_fireheart::JustEngagedWith(), and boss_viscidus::SpellHit().

◆ RemoveAurasByShapeShift()

void Unit::RemoveAurasByShapeShift ( )
5496{
5497 uint32 mechanic_mask = (1 << MECHANIC_SNARE) | (1 << MECHANIC_ROOT);
5498 for (AuraApplicationMap::iterator iter = m_appliedAuras.begin(); iter != m_appliedAuras.end();)
5499 {
5500 Aura const* aura = iter->second->GetBase();
5501 if ((aura->GetSpellInfo()->GetAllEffectsMechanicMask() & mechanic_mask) &&
5503 {
5504 RemoveAura(iter);
5505 continue;
5506 }
5507 ++iter;
5508 }
5509}
@ MECHANIC_ROOT
Definition SharedDefines.h:1343
@ SPELLFAMILY_WARRIOR
Definition SharedDefines.h:3788
@ SPELL_ATTR0_CU_AURA_CC
Definition SpellInfo.h:181
uint32 GetAllEffectsMechanicMask() const
Definition SpellInfo.cpp:1882

References SpellInfo::GetAllEffectsMechanicMask(), Aura::GetSpellInfo(), SpellInfo::HasAttribute(), m_appliedAuras, MECHANIC_ROOT, MECHANIC_SNARE, RemoveAura(), SPELL_ATTR0_CU_AURA_CC, SPELLFAMILY_WARRIOR, SpellInfo::SpellFamilyFlags, and SpellInfo::SpellFamilyName.

Referenced by AuraEffect::HandleAuraModShapeshift().

◆ RemoveAurasByType()

void Unit::RemoveAurasByType ( AuraType  auraType,
ObjectGuid  casterGUID = ObjectGuid::Empty,
Aura except = nullptr,
bool  negative = true,
bool  positive = true 
)
5336{
5337 // simple check if list is empty
5338 if (m_modAuras[auraType].empty())
5339 return;
5340
5341 for (AuraEffectList::iterator iter = m_modAuras[auraType].begin(); iter != m_modAuras[auraType].end();)
5342 {
5343 Aura* aura = (*iter)->GetBase();
5345
5346 ++iter;
5347 if (aura != except && (!casterGUID || aura->GetCasterGUID() == casterGUID)
5348 && ((negative && !aurApp->IsPositive()) || (positive && aurApp->IsPositive())))
5349 {
5350 uint32 removedAuras = m_removedAurasCount;
5351 RemoveAura(aurApp);
5352 if (m_removedAurasCount > removedAuras)
5353 iter = m_modAuras[auraType].begin();
5354 }
5355 }
5356}

References Aura::GetApplicationOfTarget(), Aura::GetCasterGUID(), Object::GetGUID(), AuraApplication::IsPositive(), m_modAuras, m_removedAurasCount, and RemoveAura().

Referenced by _EnterVehicle(), Spell::_handle_finish_phase(), Player::ActivateTaxiPathTo(), Attack(), npc_toc5_player_vehicle::npc_toc5_player_vehicleAI::BeforeSpellClick(), spell_gen_summon_tournament_mount::CheckIfLanceEquipped(), ClearComboPoints(), Player::ContinueTaxiFlight(), boss_kologarn_arms::DamageTaken(), Spell::DoSpellHitOnUnit(), Spell::EffectPowerBurn(), Spell::EffectTriggerSpell(), BattlegroundWS::EventPlayerClickedOnFlag(), ExitVehicle(), WorldSession::HandleAuctionHelloOpcode(), WorldSession::HandleAuctionListBidderItems(), WorldSession::HandleAuctionListItems(), WorldSession::HandleAuctionListOwnerItems(), WorldSession::HandleAuctionPlaceBid(), WorldSession::HandleAuctionRemoveItem(), WorldSession::HandleAuctionSellItem(), spell_warl_seduction::HandleAuraApply(), AuraEffect::HandleAuraModShapeshift(), AuraEffect::HandleAuraModStateImmunity(), AuraEffect::HandleAuraMounted(), AuraEffect::HandleAuraTransform(), WorldSession::HandleBankerActivateOpcode(), WorldSession::HandleBinderActivateOpcode(), WorldSession::HandleBuybackItem(), WorldSession::HandleBuyStableSlot(), WorldSession::HandleCancelMountAuraOpcode(), misc_commandscript::HandleDismountCommand(), spell_item_reindeer_transformation::HandleDummy(), spell_item_brewfest_mount_transformation::HandleDummy(), spell_rog_vanish::HandleEffect(), spell_hydross_mark_of_hydross::HandleEffectApply(), WorldSession::HandleGossipSelectOptionOpcode(), WorldSession::HandleListStabledPetsOpcode(), AuraEffect::HandleModMechanicImmunity(), AuraEffect::HandleModStateImmunityMask(), WorldSession::HandleMoveWorldportAck(), spell_oculus_rider_aura::HandleOnEffectApply(), spell_algalon_remove_phase_aura::HandlePeriodic(), WorldSession::HandlePetitionBuyOpcode(), spell_mage_glyph_of_icy_veins::HandleProc(), spell_mage_glyph_of_polymorph::HandleProc(), WorldSession::HandleQuestgiverHelloOpcode(), WorldSession::HandleRepairItemOpcode(), WorldSession::HandleSaveGuildEmblemOpcode(), spell_gen_mine_sweeper::HandleSchoolDMG(), WorldSession::HandleSellItemOpcode(), WorldSession::HandleSpiritHealerActivateOpcode(), WorldSession::HandleStablePet(), WorldSession::HandleStableSwapPet(), WorldSession::HandleTabardVendorActivateOpcode(), WorldSession::HandleTalentWipeConfirmOpcode(), WorldSession::HandleTaxiQueryAvailableNodes(), WorldSession::HandleTrainerBuySpellOpcode(), WorldSession::HandleUnstablePet(), boss_gurtogg_bloodboil::JustEngagedWith(), Player::LeaveBattleground(), Player::LoadFromDB(), WorldSession::LogoutPlayer(), spell_gen_aura_service_uniform::OnApply(), Player::ProcessDelayedOperations(), npc_dancing_flames::npc_dancing_flamesAI::ReceiveEmote(), Vehicle::RemoveAllPassengers(), RemoveBindSightAuras(), RemoveCharmAuras(), Battleground::RemovePlayerAtLeave(), WorldSession::SendDoFlight(), WorldSession::SendListInventory(), Player::SendLoot(), WorldSession::SendTrainerList(), SetCharmedBy(), Player::StopCastingCharm(), Player::TeleportTo(), npc_ulduar_vx001::UpdateAI(), GameObject::Use(), and npc_tapoke_slim_jahn::npc_tapoke_slim_jahnAI::WaypointReached().

◆ RemoveAurasDueToItemSpell()

void Unit::RemoveAurasDueToItemSpell ( uint32  spellId,
ObjectGuid  castItemGuid 
)
5311{
5312 for (AuraApplicationMap::iterator iter = m_appliedAuras.lower_bound(spellId); iter != m_appliedAuras.upper_bound(spellId);)
5313 {
5314 if (iter->second->GetBase()->GetCastItemGUID() == castItemGuid)
5315 {
5316 RemoveAura(iter);
5317 iter = m_appliedAuras.lower_bound(spellId);
5318 }
5319 else
5320 ++iter;
5321 }
5322
5323 for (AuraMap::iterator iter = m_ownedAuras.lower_bound(spellId); iter != m_ownedAuras.upper_bound(spellId);)
5324 {
5325 if (iter->second->GetCastItemGUID() == castItemGuid)
5326 {
5328 iter = m_ownedAuras.lower_bound(spellId);
5329 }
5330 else
5331 ++iter;
5332 }
5333}

References AURA_REMOVE_BY_DEFAULT, m_appliedAuras, m_ownedAuras, RemoveAura(), and RemoveOwnedAura().

Referenced by Player::ApplyEnchantment(), and Player::ApplyEquipSpell().

◆ RemoveAurasDueToSpell()

void Unit::RemoveAurasDueToSpell ( uint32  spellId,
ObjectGuid  casterGUID = ObjectGuid::Empty,
uint8  reqEffMask = 0,
AuraRemoveMode  removeMode = AURA_REMOVE_BY_DEFAULT 
)
5128{
5129 for (AuraApplicationMap::iterator iter = m_appliedAuras.lower_bound(spellId); iter != m_appliedAuras.upper_bound(spellId);)
5130 {
5131 Aura const* aura = iter->second->GetBase();
5132 if (((aura->GetEffectMask() & reqEffMask) == reqEffMask)
5133 && (!casterGUID || aura->GetCasterGUID() == casterGUID))
5134 {
5135 RemoveAura(iter, removeMode);
5136 iter = m_appliedAuras.lower_bound(spellId);
5137 }
5138 else
5139 ++iter;
5140 }
5141}

References Aura::GetCasterGUID(), Aura::GetEffectMask(), m_appliedAuras, and RemoveAura().

Referenced by Spell::_cast(), Player::_removeTalentAurasAndSpells(), Player::ActivateSpec(), Vehicle::AddPassenger(), spell_commander_sarannis_arcane_devastation::AfterApply(), spell_dru_feral_swiftness::AfterRemove(), spell_dru_savage_roar_aura::AfterRemove(), spell_dru_survival_instincts_aura::AfterRemove(), spell_item_thrallmar_and_honor_hold_favor::AfterRemove(), Player::ApplyEquipSpell(), boss_hakkar::boss_hakkarAI::ApplyHakkarPowerStacks(), Player::ApplyItemObtainSpells(), boss_buru::ChaseNewVictim(), spell_eredar_twins_handle_touch::CheckCast(), boss_volazj::CheckPhaseMinions(), spell_botanica_shift_form_aura::CheckProc(), spell_mage_burning_determination::CheckProc(), boss_isle_of_conquest::boss_isle_of_conquestAI::CheckRageBuff(), Player::CleanupAfterTaxiFlight(), AuraEffect::CleanupTriggeredSpells(), npc_kerlonian::npc_kerlonianAI::ClearSleeping(), spell_ruby_sanctum_rallying_shout::CountAllies(), boss_baron_geddon::boss_baron_geddonAI::DamageTaken(), boss_apothecary_hummel::boss_apothecary_hummelAI::DamageTaken(), boss_lady_deathwhisper::boss_lady_deathwhisperAI::DamageTaken(), npc_wild_wyrm::DamageTaken(), boss_essence_of_suffering::boss_essence_of_sufferingAI::DamageTaken(), boss_buru::DamageTaken(), boss_shade_of_aran::DamageTaken(), boss_leotheras_the_blind::DemonTime(), WorldState::DispelAdalsSongOfBattle(), WorldState::DispelMagtheridonTeam(), npc_drakonid_spawner::DoAction(), npc_twilight_volunteer::DoAction(), boss_prince_keleseth_icc::boss_prince_kelesethAI::DoAction(), boss_prince_taldaram_icc::boss_prince_taldaramAI::DoAction(), boss_prince_valanar_icc::boss_prince_valanarAI::DoAction(), npc_high_overlord_saurfang_icc::npc_high_overlord_saurfangAI::DoAction(), npc_muradin_bronzebeard_icc::npc_muradin_bronzebeard_iccAI::DoAction(), npc_frozen_core::DoAction(), npc_massive_jormungar::npc_massive_jormungarAI::DoAction(), npc_ferocious_rhino::npc_ferocious_rhinoAI::DoAction(), npc_ravenous_furbolg::npc_ravenous_furbolgAI::DoAction(), npc_frenzied_worgen::npc_frenzied_worgenAI::DoAction(), boss_ambassador_hellmaw::DoAction(), boss_illidan_stormrage::DoAction(), npc_maiev_illidan::DoAction(), npc_pet_gen_argent_pony_bridle::DoAction(), boss_alar::DoDiveBomb(), InstanceScript::DoRemoveAurasDueToSpellOnPlayers(), Spell::DoTriggersOnSpellHit(), Spell::EffectApplyGlyph(), Spell::EffectHeal(), Spell::EffectRemoveAura(), Spell::EffectSchoolDMG(), npc_giant_claw_tentacle::Emerge(), boss_ahune::Emerge(), boss_zuljin::EnterPhase(), BattlegroundWS::EventPlayerCapturedFlag(), BattlegroundEY::EventPlayerCapturedFlag(), BattlegroundEY::EventPlayerDroppedFlag(), BattlegroundWS::EventPlayerDroppedFlag(), npc_unworthy_initiate::npc_unworthy_initiateAI::EventStart(), BattleExperienceEvent::Execute(), SendEncounterUnit::Execute(), FrostBombExplosion::Execute(), AuraRemoveEvent::Execute(), boss_kaelthas::ExecuteMiddleEvent(), spell_sindragosa_ice_tomb_trap_aura::ExtraRemoveEffect(), spell_mother_shahraz_fatal_attraction_dummy::FilterTargets(), spell_warr_improved_spell_reflection_trigger::FilterTargets(), lfg::LFGMgr::FinishDungeon(), spell_dru_berserk::HandleAfterCast(), spell_capacitus_polarity_charge_aura::HandleAfterRemove(), spell_amanitar_remove_mushroom_power::HandleApply(), BattlegroundDS::HandleAreaTrigger(), OutdoorPvPSI::HandleAreaTrigger(), AuraEffect::HandleAuraControlVehicle(), AuraEffect::HandleAuraDummy(), AuraEffect::HandleAuraModShapeshift(), Aura::HandleAuraSpecificMods(), spell_moroes_vanish::HandleDummy(), spell_fight_fire_bomber::HandleDummy(), spell_q13007_iron_colossus::HandleDummy(), spell_pilgrims_bounty_feast_on_generic::HandleDummy(), spell_ahn_kahet_swarmer_aura::HandleDummy(), spell_halion_twilight_division::HandleDummy(), spell_putricide_ooze_eruption_searcher::HandleDummy(), spell_warhead_detonate::HandleDummy(), spell_dru_starfall_dummy::HandleDummy(), spell_q12683_take_sputum_sample::HandleDummy(), spell_magtheridon_shadow_grasp_visual::HandleDummyRemove(), spell_shadowfang_keep_forsaken_skills_aura::HandleDummyTick(), spell_oculus_soar_aura::HandleEffectPeriodic(), spell_q12730_quenching_mist::HandleEffectPeriodic(), spell_rog_prey_on_the_weak::HandleEffectPeriodic(), spell_brewfest_main_ram_buff::HandleEffectPeriodic(), spell_mc_play_dead_aura::HandleEffectRemove(), spell_reliquary_of_souls_aura_of_suffering_aura::HandleEffectRemove(), spell_serpentshrine_cavern_coilfang_water::HandleEffectRemove(), spell_q10769_dissension_amongst_the_ranks_aura::HandleEffectRemove(), boss_ragnaros::boss_ragnarosAI::HandleEmerge(), spell_midsummer_fling_torch::HandleFinish(), gm_commandscript::HandleGMVisibleCommand(), group_commandscript::HandleGroupReviveCommand(), spell_oculus_drake_flag_aura::HandleOnEffectApply(), spell_oculus_rider_aura::HandleOnEffectRemove(), spell_transitus_shield_beam_aura::HandleOnEffectRemove(), OPvPCapturePointZM_Graveyard::HandleOpenGo(), spell_hadronox_summon_periodic_aura::HandlePeriodic(), spell_algalon_phase_punch_aura::HandlePeriodic(), spell_algalon_remove_phase_aura::HandlePeriodic(), spell_serpentshrine_cavern_coilfang_water::HandlePeriodic(), AuraEffect::HandlePeriodicDamageAurasTick(), AuraEffect::HandlePeriodicTriggerSpellAuraTick(), WorldState::HandlePlayerLeaveZone(), OutdoorPvPEP::HandlePlayerLeaveZone(), OutdoorPvPHP::HandlePlayerLeaveZone(), OutdoorPvPNA::HandlePlayerLeaveZone(), OutdoorPvPSI::HandlePlayerLeaveZone(), OutdoorPvPTF::HandlePlayerLeaveZone(), OutdoorPvPZM::HandlePlayerLeaveZone(), spell_gen_consume::HandleProc(), spell_pri_t4_4p_bonus::HandleProc(), spell_item_blood_draining_enchant::HandleProc(), spell_warr_extra_proc::HandleProc(), spell_item_trinket_stack< StackSpell, TriggerSpell >::HandleProc(), spell_item_tiny_abomination_in_a_jar::HandleProc(), spell_item_tiny_abomination_in_a_jar_hero::HandleProc(), spell_icc_harvest_blight_specimen::HandleQuestComplete(), spell_felmyst_fog_of_corruption_charm_aura::HandleRemove(), spell_kiljaeden_vengeance_of_the_blue_flight_aura::HandleRemove(), spell_dru_enrage::HandleRemove(), spell_item_power_circle::HandleRemove(), spell_pal_divine_intervention::HandleRemove(), spell_pal_avenging_wrath::HandleRemove(), spell_rog_killing_spree_aura::HandleRemove(), spell_warr_vigilance::HandleRemove(), WorldSession::HandleRemoveGlyph(), spell_najentus_hurl_spine::HandleSchoolDamage(), spell_putricide_clear_aura_effect_value::HandleScript(), spell_the_lich_king_jump::HandleScript(), spell_the_lich_king_jump_remove_aura::HandleScript(), spell_icc_harvest_blight_specimen::HandleScript(), spell_festergut_pungent_blight::HandleScript(), spell_festergut_gastric_bloat::HandleScript(), spell_putricide_unbound_plague::HandleScript(), spell_putricide_eat_ooze::HandleScript(), spell_rotface_little_ooze_combine::HandleScript(), spell_rotface_large_ooze_combine::HandleScript(), spell_rotface_large_ooze_buff_combine::HandleScript(), spell_eject_passenger_wild_wyrm::HandleScript(), spell_q10651_q10692_book_of_fel_names::HandleScript(), spell_q12641_death_comes_from_on_high_recall_eye::HandleScriptEffect(), spell_halion_clear_debuffs::HandleScriptEffect(), spell_q12823_remove_collapsing_cave_aura::HandleScriptEffect(), spell_illidari_council_judgement::HandleScriptEffect(), AuraEffect::HandleShapeshiftBoosts(), ArenaSpectator::HandleSpectatorWatchCommand(), AuraEffect::HandleSpiritOfRedemption(), spell_capacitus_polarity_charge::HandleTargets(), misc_commandscript::HandleUnAuraCommand(), misc_commandscript::HandleUnFreezeCommand(), boss_valithria_dreamwalker::boss_valithria_dreamwalkerAI::HealReceived(), npc_underbog_mushroom::InitializeAI(), npc_demon_chain::JustDied(), boss_azuregos::boss_azuregosAI::JustDied(), npc_q24545_wretched_ghoul::npc_q24545_wretched_ghoulAI::JustDied(), boss_zuljin::JustEngagedWith(), boss_bronjahm::boss_bronjahmAI::JustEngagedWith(), boss_doomwalker::JustEngagedWith(), boss_gruul::JustEngagedWith(), boss_pathaleon_the_calculator::JustEngagedWith(), npc_pet_shaman_fire_elemental::JustEngagedWith(), boss_the_lich_king::boss_the_lich_kingAI::JustEngagedWith(), boss_jeklik::JustEngagedWith(), boss_buru::JustEngagedWith(), boss_gal_darah::JustEngagedWith(), boss_prince_keleseth_icc::boss_prince_kelesethAI::JustEngagedWith(), boss_prince_taldaram_icc::boss_prince_taldaramAI::JustEngagedWith(), boss_prince_valanar_icc::boss_prince_valanarAI::JustEngagedWith(), boss_deathbringer_saurfang::boss_deathbringer_saurfangAI::JustEngagedWith(), boss_lady_deathwhisper::boss_lady_deathwhisperAI::JustEngagedWith(), boss_gurtogg_bloodboil::JustEngagedWith(), boss_hydross_the_unstable::JustReachedHome(), boss_tenris_mirkblood::KilledUnit(), boss_felblood_kaelthas::LapseAction(), npc_crystalline_frayer::LeaveSeedPod(), boss_garfrost::boss_garfrostAI::MovementInform(), npc_highlord_darion_mograine::npc_highlord_darion_mograineAI::MovementInform(), boss_felmyst::MovementInform(), boss_shade_of_akama::MovementInform(), boss_kaelthas::MovementInform(), boss_jedoga_shadowseeker::MovementInform(), npc_ball_of_flame::npc_ball_of_flameAI::MovementInform(), boss_skadi_grauf::boss_skadi_graufAI::MovementInform(), npc_image_of_medivh::npc_image_of_medivhAI::NextStep(), spell_halion_twilight_realm_aura::OnApply(), spell_halion_leave_twilight_realm_aura::OnApply(), spell_systems_shutdown_aura::OnApply(), npc_chesspiece::OnCharmed(), npc_aged_dying_ancient_kodo::OnGossipHello(), spell_claw_rage_aura::OnPeriodic(), spell_yogg_saron_empowered_aura::OnPeriodic(), spell_gen_curse_of_pain::OnPeriodic(), spell_illidan_demon_transform2_aura::OnPeriodic(), BattlefieldWG::OnPlayerLeaveZone(), lfg::LFGPlayerScript::OnPlayerMapChanged(), MidsummerPlayerScript::OnPlayerUpdateZone(), boss_shade_of_aran::OnPowerUpdate(), spell_halion_combustion_consumption_aura::OnRemove(), spell_halion_leave_twilight_realm_aura::OnRemove(), spell_algalon_phase_punch_aura::OnRemove(), spell_load_into_catapult_aura::OnRemove(), spell_dru_barkskin::OnRemove(), spell_gen_damage_reduction_aura::OnRemove(), spell_hun_ascpect_of_the_viper::OnRemove(), spell_hun_viper_attack_speed::OnRemove(), spell_item_with_mount_speed::OnRemove(), spell_item_desperate_defense::OnRemove(), spell_item_shadowmourne::OnRemove(), spell_item_shadowmourne_soul_fragment::OnRemove(), spell_item_trinket_stack< StackSpell, TriggerSpell >::OnRemove(), spell_item_tiny_abomination_in_a_jar::OnRemove(), spell_item_tiny_abomination_in_a_jar_hero::OnRemove(), spell_mage_combustion_proc::OnRemove(), spell_mage_fingers_of_frost::OnRemove(), spell_item_shadowmourne_soul_fragment::OnStackChange(), npc_valkyr_shadowguard::npc_valkyr_shadowguardAI::PassengerBoarded(), npc_strangulate_vehicle::npc_strangulate_vehicleAI::PassengerBoarded(), npc_wild_wyrm::PassengerBoarded(), npc_preparations_for_war_vehicle::PassengerBoarded(), boss_jeklik::PathEndReached(), spell_quest_test_flight_charging::PerformKick(), spell_rog_stealth_buff_tracker< RemoveSpellId >::PeriodicTick(), SmartScript::ProcessAction(), ProcessTerrainStatusUpdate(), spell_gen_defend::RefreshVisualShields(), RemoveAurasDueToSpellByDispel(), BattlefieldWG::RemoveAurasFromPlayer(), boss_festergut::boss_festergutAI::RemoveBlight(), spell_warl_health_funnel::RemoveEffect(), RemoveGameObject(), spell_mage_frostfire_bolt::RemovePermafrost(), BattlegroundAV::RemovePlayer(), Battleground::RemovePlayerFromResurrectQueue(), boss_keristrasza::RemovePrison(), Pet::removeSpell(), Player::removeSpell(), spell_gen_eject_all_passengers::RemoveVehicleAuras(), spell_gen_defend::RemoveVisualShields(), boss_malchezaar::Reset(), boss_baroness_anastari::boss_baroness_anastariAI::Reset(), boss_kiljaeden::Reset(), boss_twilight_corrupter::Reset(), boss_nalorakk::Reset(), boss_mandokir::boss_mandokirAI::Reset(), boss_thekal::Reset(), boss_cthun::Reset(), boss_viscidus::Reset(), boss_halion::boss_halionAI::Reset(), boss_deathbringer_saurfang::boss_deathbringer_saurfangAI::Reset(), boss_leotheras_the_blind::Reset(), boss_lethon::boss_lethonAI::Reset(), boss_taerar::boss_taerarAI::Reset(), boss_high_botanist_freywinn::ResumeEncounter(), Player::ResurrectPlayer(), npc_finklestein::npc_finklesteinAI::RightClickCauldron(), boss_magtheridon::ScheduleCombatEvents(), boss_supremus::SchedulePhase(), boss_laj::ScheduleTasks(), Player::SendQuestUpdate(), npc_corrupted_totem::SetAura(), OPvPCapturePointZM_Graveyard::SetBeaconState(), boss_hydross_the_unstable::SetForm(), Player::SetGMVisible(), boss_mandokir::boss_mandokirAI::SetGUID(), Player::SetIsSpectator(), SetModelVisible(), npc_akama_shade::sGossipSelect(), boss_viscidus::SoftReset(), boss_ossirian::SpellHit(), npc_omen::npc_omenAI::SpellHit(), npc_troll_volunteer::npc_troll_volunteerAI::SpellHit(), boss_sister_svalna::boss_sister_svalnaAI::SpellHit(), boss_faerlina::boss_faerlinaAI::SpellHit(), advisor_baseAI::SpellHit(), boss_anub_arak::SpellHitTarget(), boss_moorabi::boss_moorabiAI::SpellHitTarget(), boss_ahune::Submerge(), npc_bh_thalorien_dawnseeker::npc_bh_thalorien_dawnseekerAI::SummonedCreatureDespawn(), boss_drakkari_colossus::boss_drakkari_colossusAI::SummonedCreatureDespawn(), boss_cthun::SummonedCreatureDies(), npc_kiljaeden_controller::SummonedCreatureDies(), boss_anub_arak::SummonedCreatureDies(), boss_anzu::SummonedCreatureDies(), boss_viscidus::SummonedCreatureDies(), boss_terestian_illhoof::SummonKilrek(), Player::SummonPet(), boss_netherspite::SwitchToBanishPhase(), boss_netherspite::SwitchToPortalPhase(), Totem::UnSummon(), spell_black_temple_spell_absorption_aura::Update(), boss_ragnaros::boss_ragnarosAI::UpdateAI(), boss_renataki::boss_renatakiAI::UpdateAI(), boss_moam::UpdateAI(), npc_draenei_survivor::npc_draenei_survivorAI::UpdateAI(), boss_volazj::UpdateAI(), boss_anub_arak::UpdateAI(), npc_frost_sphere::npc_frost_sphereAI::UpdateAI(), boss_jormungarAI::UpdateAI(), npc_hor_leader::npc_hor_leaderAI::UpdateAI(), boss_drakkari_colossus::boss_drakkari_colossusAI::UpdateAI(), boss_blood_queen_lana_thel::boss_blood_queen_lana_thelAI::UpdateAI(), npc_cult_fanatic::npc_cult_fanaticAI::UpdateAI(), npc_cult_adherent::npc_cult_adherentAI::UpdateAI(), boss_professor_putricide::boss_professor_putricideAI::UpdateAI(), npc_tirion_fordring_tft::npc_tirion_fordringAI::UpdateAI(), npc_crok_scourgebane::npc_crok_scourgebaneAI::UpdateAI(), boss_thaddius_summon::boss_thaddius_summonAI::UpdateAI(), boss_algalon_the_observer::UpdateAI(), boss_freya_lifebinder::UpdateAI(), boss_freya_healthy_spore::UpdateAI(), boss_mimiron::UpdateAI(), boss_palehoof::boss_palehoofAI::UpdateAI(), boss_anzu::UpdateAI(), npc_pet_gen_soul_trader_beacon::UpdateAI(), npc_pet_gen_argent_pony_bridle::UpdateAI(), npc_pet_darting_hatchling::UpdateAI(), boss_taerar::boss_taerarAI::UpdateAI(), and Player::UpdateTitansGrip().

◆ RemoveAurasDueToSpellByDispel()

void Unit::RemoveAurasDueToSpellByDispel ( uint32  spellId,
uint32  dispellerSpellId,
ObjectGuid  casterGUID,
Unit dispeller,
uint8  chargesRemoved = 1 
)
5161{
5162 AuraMapBoundsNonConst range = m_ownedAuras.equal_range(spellId);
5163 for (AuraMap::iterator iter = range.first; iter != range.second;)
5164 {
5165 Aura* aura = iter->second;
5166 if (aura->GetCasterGUID() == casterGUID)
5167 {
5168 DispelInfo dispelInfo(dispeller, dispellerSpellId, chargesRemoved);
5169
5170 // Call OnDispel hook on AuraScript
5171 aura->CallScriptDispel(&dispelInfo);
5172
5174 aura->ModCharges(-dispelInfo.GetRemovedCharges(), AURA_REMOVE_BY_ENEMY_SPELL);
5175 else
5176 aura->ModStackAmount(-dispelInfo.GetRemovedCharges(), AURA_REMOVE_BY_ENEMY_SPELL);
5177
5178 // Call AfterDispel hook on AuraScript
5179 aura->CallScriptAfterDispel(&dispelInfo);
5180
5181 switch (aura->GetSpellInfo()->SpellFamilyName)
5182 {
5183 case SPELLFAMILY_HUNTER:
5184 {
5185 // Noxious Stings
5186 if (aura->GetSpellInfo()->SpellFamilyFlags[1] & 0x1000)
5187 {
5188 if (Unit* caster = aura->GetCaster())
5189 {
5190 if (AuraEffect* aureff = caster->GetAuraEffect(SPELL_AURA_OVERRIDE_CLASS_SCRIPTS, SPELLFAMILY_HUNTER, 3521, 1))
5191 {
5192 if (Aura* noxious = Aura::TryCreate(aura->GetSpellInfo(), aura->GetEffectMask(), dispeller, caster))
5193 {
5194 noxious->SetDuration(aura->GetDuration() * aureff->GetAmount() / 100);
5195 if (aura->GetUnitOwner())
5196 if (const std::vector<int32>* spell_triggered = sSpellMgr->GetSpellLinked(-int32(aura->GetId())))
5197 for (std::vector<int32>::const_iterator itr = spell_triggered->begin(); itr != spell_triggered->end(); ++itr)
5198 aura->GetUnitOwner()->RemoveAurasDueToSpell(*itr);
5199 }
5200 }
5201 }
5202 }
5203 break;
5204 }
5206 {
5207 // Icy Clutch, remove with Frost Fever
5208 if (aura->GetSpellInfo()->SpellFamilyFlags[1] & 0x4000000)
5209 {
5210 if (AuraEffect* aureff = GetAuraEffect(SPELL_AURA_MOD_DECREASE_SPEED, SPELLFAMILY_DEATHKNIGHT, 0, 0x40000, 0, casterGUID))
5211 RemoveAurasDueToSpell(aureff->GetId());
5212 }
5213 }
5214 default:
5215 break;
5216 }
5217 return;
5218 }
5219 else
5220 ++iter;
5221 }
5222}
void CallScriptDispel(DispelInfo *dispelInfo)
Definition SpellAuras.cpp:2393
Unit * GetUnitOwner() const
Definition SpellAuras.h:108
static Aura * TryCreate(SpellInfo const *spellproto, uint8 effMask, WorldObject *owner, Unit *caster, int32 *baseAmount=nullptr, Item *castItem=nullptr, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemGUID=ObjectGuid::Empty)
Definition SpellAuras.cpp:291
bool ModCharges(int32 num, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
Definition SpellAuras.cpp:915
void CallScriptAfterDispel(DispelInfo *dispelInfo)
Definition SpellAuras.cpp:2406
Definition Unit.h:303

References AURA_REMOVE_BY_ENEMY_SPELL, Aura::CallScriptAfterDispel(), Aura::CallScriptDispel(), GetAuraEffect(), Aura::GetCaster(), Aura::GetCasterGUID(), Aura::GetDuration(), Aura::GetEffectMask(), Aura::GetId(), DispelInfo::GetRemovedCharges(), Aura::GetSpellInfo(), Aura::GetUnitOwner(), SpellInfo::HasAttribute(), m_ownedAuras, Aura::ModCharges(), Aura::ModStackAmount(), RemoveAurasDueToSpell(), SPELL_ATTR7_DISPEL_REMOVES_CHARGES, SPELL_AURA_MOD_DECREASE_SPEED, SPELL_AURA_OVERRIDE_CLASS_SCRIPTS, SPELLFAMILY_DEATHKNIGHT, SPELLFAMILY_HUNTER, SpellInfo::SpellFamilyFlags, SpellInfo::SpellFamilyName, sSpellMgr, and Aura::TryCreate().

Referenced by Spell::EffectDispel().

◆ RemoveAurasDueToSpellBySteal()

void Unit::RemoveAurasDueToSpellBySteal ( uint32  spellId,
ObjectGuid  casterGUID,
Unit stealer 
)
5225{
5226 AuraMapBoundsNonConst range = m_ownedAuras.equal_range(spellId);
5227 for (AuraMap::iterator iter = range.first; iter != range.second;)
5228 {
5229 Aura* aura = iter->second;
5230 if (aura->GetCasterGUID() == casterGUID)
5231 {
5232 int32 damage[MAX_SPELL_EFFECTS];
5233 int32 baseDamage[MAX_SPELL_EFFECTS];
5234 uint8 effMask = 0;
5235 uint8 recalculateMask = 0;
5236 Unit* caster = aura->GetCaster();
5237 for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
5238 {
5239 if (aura->GetEffect(i))
5240 {
5241 baseDamage[i] = aura->GetEffect(i)->GetBaseAmount();
5242 damage[i] = aura->GetEffect(i)->GetAmount();
5243 effMask |= (1 << i);
5244 if (aura->GetEffect(i)->CanBeRecalculated())
5245 recalculateMask |= (1 << i);
5246 }
5247 else
5248 {
5249 baseDamage[i] = 0;
5250 damage[i] = 0;
5251 }
5252 }
5253
5255 // Cast duration to unsigned to prevent permanent aura's such as Righteous Fury being permanently added to caster
5256 uint32 dur = std::min(2u * MINUTE * IN_MILLISECONDS, uint32(aura->GetDuration()));
5257
5258 if (Aura* oldAura = stealer->GetAura(aura->GetId(), aura->GetCasterGUID()))
5259 {
5260 if (stealCharge)
5261 oldAura->ModCharges(1);
5262 else
5263 oldAura->ModStackAmount(1);
5264 oldAura->SetDuration(int32(dur));
5265 }
5266 else
5267 {
5268 // single target state must be removed before aura creation to preserve existing single target aura
5269 if (aura->IsSingleTarget())
5270 aura->UnregisterSingleTarget();
5271
5272 // Xinef: if stealer has same aura
5273 Aura* curAura = stealer->GetAura(aura->GetId());
5274 if (!curAura || (!curAura->IsPermanent() && curAura->GetDuration() < (int32)dur))
5275 if (Aura* newAura = Aura::TryRefreshStackOrCreate(aura->GetSpellInfo(), effMask, stealer, nullptr, &baseDamage[0], nullptr, stealer->GetGUID()))
5276 {
5277 // created aura must not be single target aura,, so stealer won't loose it on recast
5278 if (newAura->IsSingleTarget())
5279 {
5280 newAura->UnregisterSingleTarget();
5281 // bring back single target aura status to the old aura
5282 aura->SetIsSingleTarget(true);
5283 caster->GetSingleCastAuras().push_back(aura);
5284 }
5285 // FIXME: using aura->GetMaxDuration() maybe not blizzlike but it fixes stealing of spells like Innervate
5286 newAura->SetLoadedState(aura->GetMaxDuration(), int32(dur), stealCharge ? 1 : aura->GetCharges(), 1, recalculateMask, &damage[0]);
5287
5288 // Reset periodic timers so stolen HoTs tick properly
5289 // For stolen auras we need fresh tick counters since no ticks have occurred yet
5290 for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
5291 if (AuraEffect* aurEff = newAura->GetEffect(i))
5292 aurEff->ResetPeriodic(true);
5293
5294 newAura->ApplyForTargets();
5295 }
5296 }
5297
5298 if (stealCharge)
5300 else
5302
5303 return;
5304 }
5305 else
5306 ++iter;
5307 }
5308}
bool CanBeRecalculated() const
Definition SpellAuraEffects.h:78
int32 GetBaseAmount() const
Definition SpellAuraEffects.h:57
void UnregisterSingleTarget()
Definition SpellAuras.cpp:1113
AuraEffect * GetEffect(uint8 effIndex) const
Definition SpellAuras.h:176
bool IsPermanent() const
Definition SpellAuras.h:139

References AURA_REMOVE_BY_ENEMY_SPELL, AuraEffect::CanBeRecalculated(), AuraEffect::GetAmount(), GetAura(), AuraEffect::GetBaseAmount(), Aura::GetCaster(), Aura::GetCasterGUID(), Aura::GetCharges(), Aura::GetDuration(), Aura::GetEffect(), Object::GetGUID(), Aura::GetId(), Aura::GetMaxDuration(), GetSingleCastAuras(), Aura::GetSpellInfo(), SpellInfo::HasAttribute(), IN_MILLISECONDS, Aura::IsPermanent(), Aura::IsSingleTarget(), m_ownedAuras, MAX_SPELL_EFFECTS, MINUTE, Aura::ModCharges(), Aura::ModStackAmount(), Aura::SetIsSingleTarget(), SPELL_ATTR7_DISPEL_REMOVES_CHARGES, Aura::TryRefreshStackOrCreate(), and Aura::UnregisterSingleTarget().

Referenced by Spell::EffectStealBeneficialBuff().

◆ RemoveAurasWithAttribute()

void Unit::RemoveAurasWithAttribute ( uint32  flags)
5359{
5360 for (AuraApplicationMap::iterator iter = m_appliedAuras.begin(); iter != m_appliedAuras.end();)
5361 {
5362 SpellInfo const* spell = iter->second->GetBase()->GetSpellInfo();
5363 if (spell->Attributes & flags)
5364 RemoveAura(iter);
5365 else
5366 ++iter;
5367 }
5368}

References SpellInfo::Attributes, m_appliedAuras, and RemoveAura().

◆ RemoveAurasWithFamily()

void Unit::RemoveAurasWithFamily ( SpellFamilyNames  family,
uint32  familyFlag1,
uint32  familyFlag2,
uint32  familyFlag3,
ObjectGuid  casterGUID 
)
5442{
5443 for (AuraApplicationMap::iterator iter = m_appliedAuras.begin(); iter != m_appliedAuras.end();)
5444 {
5445 Aura const* aura = iter->second->GetBase();
5446 if (!casterGUID || aura->GetCasterGUID() == casterGUID)
5447 {
5448 SpellInfo const* spell = aura->GetSpellInfo();
5449 if (spell->SpellFamilyName == uint32(family) && spell->SpellFamilyFlags.HasFlag(familyFlag1, familyFlag2, familyFlag3))
5450 {
5451 RemoveAura(iter);
5452 continue;
5453 }
5454 }
5455 ++iter;
5456 }
5457}

References Aura::GetCasterGUID(), Aura::GetSpellInfo(), flag96::HasFlag(), m_appliedAuras, RemoveAura(), SpellInfo::SpellFamilyFlags, and SpellInfo::SpellFamilyName.

Referenced by spell_warl_demonic_aegis::HandleAuraApply(), and Aura::HandleAuraSpecificMods().

◆ RemoveAurasWithInterruptFlags()

void Unit::RemoveAurasWithInterruptFlags ( uint32  flag,
uint32  except = 0,
bool  isAutoshot = false 
)
5407{
5408 if (!(m_interruptMask & flag))
5409 return;
5410
5411 // interrupt auras
5412 for (AuraApplicationList::iterator iter = m_interruptableAuras.begin(); iter != m_interruptableAuras.end();)
5413 {
5414 Aura* aura = (*iter)->GetBase();
5415 ++iter;
5416 if ((aura->GetSpellInfo()->AuraInterruptFlags & flag) && (!except || aura->GetId() != except))
5417 {
5418 uint32 removedAuras = m_removedAurasCount;
5419 RemoveAura(aura);
5420 if (m_removedAurasCount > removedAuras + 1)
5421 iter = m_interruptableAuras.begin();
5422 }
5423 }
5424
5425 // interrupt channeled spell
5427 {
5428 if (spell->getState() == SPELL_STATE_CASTING && (spell->m_spellInfo->ChannelInterruptFlags & flag) && spell->m_spellInfo->Id != except)
5429 {
5430 // Do not interrupt if auto shot
5431 if (!(isAutoshot && spell->m_spellInfo->HasAttribute(SPELL_ATTR2_DO_NOT_RESET_COMBAT_TIMERS)))
5432 {
5433 InterruptNonMeleeSpells(false, spell->m_spellInfo->Id);
5434 }
5435 }
5436 }
5437
5439}

References SpellInfo::AuraInterruptFlags, CURRENT_CHANNELED_SPELL, Aura::GetId(), Aura::GetSpellInfo(), InterruptNonMeleeSpells(), m_currentSpells, m_interruptableAuras, m_interruptMask, m_removedAurasCount, RemoveAura(), SPELL_ATTR2_DO_NOT_RESET_COMBAT_TIMERS, SPELL_STATE_CASTING, and UpdateInterruptMask().

Referenced by _EnterVehicle(), AttackerStateUpdate(), ClearInPetCombat(), CombatStart(), CombatStartOnCast(), DealDamage(), Dismount(), Spell::DoAllEffectOnTarget(), Spell::DoSpellHitOnUnit(), BattlegroundWS::EventPlayerCapturedFlag(), BattlegroundEY::EventPlayerCapturedFlag(), BattlegroundEY::EventPlayerClickedOnFlag(), BattlegroundWS::EventPlayerClickedOnFlag(), BattlegroundAB::EventPlayerClickedOnFlag(), spell_rog_killing_spree::FilterTargets(), AuraEffect::HandleAuraModSchoolImmunity(), AuraEffect::HandleFeignDeath(), WorldSession::HandleGossipHelloOpcode(), AuraEffect::HandleModInvisibility(), AuraEffect::HandleModStealth(), AuraEffect::HandleModUnattackable(), WorldSession::HandleMoverRelocation(), AuraEffect::HandlePeriodicManaLeechAuraTick(), AuraEffect::HandlePhase(), Player::LoadFromDB(), WorldSession::LogoutPlayer(), Mount(), Spell::prepare(), WorldSession::ProcessMovementInfo(), ProcessTerrainStatusUpdate(), Player::SetInWater(), SetStandState(), Player::TeleportTo(), and UpdatePosition().

◆ RemoveAurasWithMechanic()

void Unit::RemoveAurasWithMechanic ( uint32  mechanic_mask,
AuraRemoveMode  removemode = AURA_REMOVE_BY_DEFAULT,
uint32  except = 0 
)
5479{
5480 for (AuraApplicationMap::iterator iter = m_appliedAuras.begin(); iter != m_appliedAuras.end();)
5481 {
5482 Aura const* aura = iter->second->GetBase();
5483 if (!except || aura->GetId() != except)
5484 {
5485 if (aura->GetSpellInfo()->GetAllEffectsMechanicMask() & mechanic_mask)
5486 {
5487 RemoveAura(iter, removemode);
5488 continue;
5489 }
5490 }
5491 ++iter;
5492 }
5493}

References SpellInfo::GetAllEffectsMechanicMask(), Aura::GetId(), Aura::GetSpellInfo(), m_appliedAuras, and RemoveAura().

Referenced by AuraEffect::HandleModMechanicImmunity(), AuraEffect::HandleModStateImmunityMask(), spell_rog_vanish_purge::HandleRootRemove(), spell_rog_vanish_purge::HandleSnareRemove(), and RemoveMovementImpairingAuras().

◆ RemoveBindSightAuras()

void Unit::RemoveBindSightAuras ( )
8185{
8187}
@ SPELL_AURA_BIND_SIGHT
Definition SpellAuraDefines.h:64

References RemoveAurasByType(), and SPELL_AURA_BIND_SIGHT.

Referenced by RemoveFromWorld().

◆ RemoveCharmAuras()

void Unit::RemoveCharmAuras ( )

◆ RemoveCharmedBy()

void Unit::RemoveCharmedBy ( Unit charmer)
14919{
14920 if (!IsCharmed())
14921 return;
14922
14923 if (!charmer)
14924 charmer = GetCharmer();
14925 if (charmer != GetCharmer()) // one aura overrides another?
14926 {
14927 // LOG_FATAL("entities.unit", "Unit::RemoveCharmedBy: this: {} true charmer: {} false charmer: {}",
14928 // GetGUID().ToString(), GetCharmerGUID().ToString(), charmer->GetGUID().ToString());
14929 // ABORT();
14930 return;
14931 }
14932
14933 CharmType type;
14935 type = CHARM_TYPE_POSSESS;
14936 else if (charmer && charmer->IsOnVehicle(this))
14937 type = CHARM_TYPE_VEHICLE;
14938 else
14939 type = CHARM_TYPE_CHARM;
14940
14941 if (_oldFactionId)
14942 {
14944 _oldFactionId = 0;
14945 }
14946 else
14948
14949 CastStop();
14950 AttackStop();
14951
14952 // xinef: update speed after charming
14953 UpdateSpeed(MOVE_RUN, false);
14954
14955 // xinef: do not break any controlled motion slot
14956 if (GetMotionMaster()->GetMotionSlotType(MOTION_SLOT_CONTROLLED) == NULL_MOTION_TYPE)
14957 {
14958 StopMoving();
14960 }
14961 // xinef: if we have any controlled movement, clear active and idle only
14962 else
14964
14966
14967 // xinef: remove stunned flag if owner was mounted
14970
14971 // If charmer still exists
14972 if (!charmer)
14973 return;
14974
14975 ASSERT(type != CHARM_TYPE_POSSESS || charmer->IsPlayer());
14976 ASSERT(type != CHARM_TYPE_VEHICLE || (IsCreature() && IsVehicle()));
14977
14978 charmer->SetCharm(this, false);
14979
14981
14982 Player* playerCharmer = charmer->ToPlayer();
14983 if (playerCharmer)
14984 {
14985 switch (type)
14986 {
14987 case CHARM_TYPE_VEHICLE:
14988 playerCharmer->SetClientControl(this, false);
14989 playerCharmer->SetClientControl(charmer, true); // verified
14992 break;
14993 case CHARM_TYPE_POSSESS:
14994 playerCharmer->SetClientControl(this, false);
14995 playerCharmer->SetClientControl(charmer, true); // verified
15000 break;
15001 case CHARM_TYPE_CHARM:
15003 {
15005 if (cinfo && cinfo->type == CREATURE_TYPE_DEMON)
15006 {
15008 if (GetCharmInfo())
15009 GetCharmInfo()->SetPetNumber(0, true);
15010 else
15011 LOG_ERROR("entities.unit", "Aura::HandleModCharm: target={} has a charm aura but no charm info!", GetGUID().ToString());
15012 }
15013 }
15014 break;
15015 default:
15016 break;
15017 }
15018 }
15019
15020 if (Player* player = ToPlayer())
15021 {
15022 sScriptMgr->AnticheatSetUnderACKmount(player);
15023 }
15024
15025 // xinef: restore threat
15026 for (CharmThreatMap::const_iterator itr = _charmThreatInfo.begin(); itr != _charmThreatInfo.end(); ++itr)
15027 {
15028 if (Unit* target = ObjectAccessor::GetUnit(*this, itr->first))
15029 if (!IsFriendlyTo(target))
15030 AddThreat(target, itr->second);
15031 }
15032
15033 _charmThreatInfo.clear();
15034
15035 if (Creature* creature = ToCreature())
15036 {
15037 // Vehicle should not attack its passenger after he exists the seat
15038 if (type != CHARM_TYPE_VEHICLE && charmer->IsAlive() && !charmer->IsFriendlyTo(creature))
15039 if (Attack(charmer, true))
15040 GetMotionMaster()->MoveChase(charmer);
15041
15042 // Creature will restore its old AI on next update
15043 if (creature->AI())
15044 creature->AI()->OnCharmed(false);
15045
15046 // Xinef: Remove movement flag flying
15048 }
15049 else
15050 ToPlayer()->SetClientControl(this, true); // verified
15051
15052 // a guardian should always have charminfo
15053 if (playerCharmer && this != charmer->GetFirstControlled())
15054 playerCharmer->SendRemoveControlBar();
15055
15056 // xinef: Always delete charm info (restores react state)
15057 if (IsPlayer() || (IsCreature() && !ToCreature()->IsGuardian()))
15059}
CharmType
Definition CharmInfo.h:44
@ CHARM_TYPE_CHARM
Definition CharmInfo.h:45
@ CHARM_TYPE_POSSESS
Definition CharmInfo.h:46
@ CHARM_TYPE_VEHICLE
Definition CharmInfo.h:47
@ MOTION_SLOT_CONTROLLED
Definition MotionMaster.h:65
@ MOTION_SLOT_ACTIVE
Definition MotionMaster.h:64
@ NULL_MOTION_TYPE
Definition MotionMaster.h:58
@ CREATURE_TYPE_DEMON
Definition SharedDefines.h:2631
@ CLASS_WARLOCK
Definition SharedDefines.h:149
@ CLASS_CONTEXT_PET_CHARM
Definition UnitDefines.h:241
@ UNIT_STATE_NO_ENVIRONMENT_UPD
Definition UnitDefines.h:198
@ MOVE_RUN
Definition UnitDefines.h:354
void InitDefault()
Definition MotionMaster.cpp:88
void MovementExpiredOnSlot(MovementSlot slot, bool reset=true)
Definition MotionMaster.h:219
void MovementExpired(bool reset=true)
Definition MotionMaster.h:205
void SetByteValue(uint16 index, uint8 offset, uint8 value)
Definition Object.cpp:739
void SendRemoveControlBar()
Definition Player.cpp:9728
void SetClientControl(Unit *target, bool allowMove, bool packetOnly=false)
Definition Player.cpp:12845
void DeleteCharmInfo()
Definition Unit.cpp:12815
void RestoreFaction()
Definition Unit.cpp:15061
void SetCharm(Unit *target, bool apply)
Definition Unit.cpp:7865
void StopAttackingInvalidTarget()
Definition Unit.cpp:16297
void CastStop(uint32 except_spellid=0, bool withInstant=true)
Interrupt the unit cast for all the current spells.
Definition Unit.cpp:1295
bool Attack(Unit *victim, bool meleeAttack)
Definition Unit.cpp:7236
CharmThreatMap _charmThreatInfo
Definition Unit.h:2182
void RemoveUnitMovementFlag(uint32 f)
Definition Unit.h:767
void UpdateSpeed(UnitMoveType mtype, bool forced)
Definition Unit.cpp:11189
uint32 unit_class
Definition CreatureData.h:213

References _charmThreatInfo, _oldFactionId, AddThreat(), ASSERT, Attack(), AttackStop(), CastStop(), CHARM_TYPE_CHARM, CHARM_TYPE_POSSESS, CHARM_TYPE_VEHICLE, CLASS_CONTEXT_PET_CHARM, CLASS_WARLOCK, ClearUnitState(), CREATURE_TYPE_DEMON, DeleteCharmInfo(), GetCharmer(), GetCharmInfo(), Creature::GetCreatureTemplate(), GetFirstControlled(), Object::GetGUID(), GetMotionMaster(), ObjectAccessor::GetUnit(), HasUnitState(), MotionMaster::InitDefault(), IsAlive(), IsCharmed(), IsClass(), Object::IsCreature(), IsFriendlyTo(), IsGuardian(), IsOnVehicle(), Object::IsPlayer(), IsVehicle(), LOG_ERROR, MOTION_SLOT_ACTIVE, MOTION_SLOT_CONTROLLED, MOVE_RUN, MotionMaster::MoveChase(), MotionMaster::MovementExpired(), MotionMaster::MovementExpiredOnSlot(), MOVEMENTFLAG_FLYING, NULL_MOTION_TYPE, RemoveUnitFlag(), RemoveUnitMovementFlag(), RestoreFaction(), Player::SendRemoveControlBar(), Object::SetByteValue(), SetCharm(), Player::SetClientControl(), SetFaction(), CharmInfo::SetPetNumber(), sScriptMgr, StopAttackingInvalidTarget(), StopMoving(), Object::ToCreature(), Object::ToPlayer(), Position::ToString(), CreatureTemplate::type, CreatureTemplate::unit_class, UNIT_FIELD_BYTES_0, UNIT_FLAG_DISABLE_MOVE, UNIT_FLAG_POSSESSED, UNIT_FLAG_STUNNED, UNIT_STATE_NO_ENVIRONMENT_UPD, UNIT_STATE_POSSESSED, UNIT_STATE_STUNNED, and UpdateSpeed().

Referenced by AuraEffect::HandleCharmConvert(), AuraEffect::HandleModCharm(), AuraEffect::HandleModPossess(), AuraEffect::HandleModPossessPet(), npc_chesspiece::JustDied(), Puppet::RemoveFromWorld(), Vehicle::RemovePassenger(), and npc_chesspiece::sGossipSelect().

◆ RemoveComboPointHolder()

void Unit::RemoveComboPointHolder ( Unit unit)
inline
1013{ m_ComboPointHolders.erase(unit); }

References m_ComboPointHolders.

Referenced by AddComboPoints(), and ClearComboPoints().

◆ RemoveDynObject()

bool Unit::RemoveDynObject ( uint32  spellId)
6475{
6476 if (m_dynObj.empty())
6477 return false;
6478
6479 bool result = false;
6480 for (DynObjectList::iterator i = m_dynObj.begin(); i != m_dynObj.end();)
6481 {
6482 DynamicObject* dynObj = *i;
6483 if (dynObj->GetSpellId() == spellId)
6484 {
6485 dynObj->Remove();
6486 i = m_dynObj.begin();
6487 result = true;
6488 }
6489 else
6490 ++i;
6491 }
6492
6493 return result;
6494}
void Remove()
Definition DynamicObject.cpp:180

References DynamicObject::GetSpellId(), m_dynObj, and DynamicObject::Remove().

Referenced by Spell::cancel(), Spell::EffectAddFarsight(), and spell_item_shifting_naaru_silver::OnBaseRemove().

◆ RemoveEvadeAuras()

void Unit::RemoveEvadeAuras ( )
5663{
5664 for (AuraApplicationMap::iterator iter = m_appliedAuras.begin(); iter != m_appliedAuras.end();)
5665 {
5666 Aura const* aura = iter->second->GetBase();
5667 SpellInfo const* spellInfo = aura->GetSpellInfo();
5669 || spellInfo->HasAura(SPELL_AURA_CLONE_CASTER) || (aura->IsPassive() && GetOwnerGUID().IsPlayer()))
5670 ++iter;
5671 else
5673 }
5674
5675 for (AuraMap::iterator iter = m_ownedAuras.begin(); iter != m_ownedAuras.end();)
5676 {
5677 Aura* aura = iter->second;
5678 SpellInfo const* spellInfo = aura->GetSpellInfo();
5680 || spellInfo->HasAura(SPELL_AURA_CLONE_CASTER) || (aura->IsPassive() && GetOwnerGUID().IsPlayer()))
5681 ++iter;
5682 else
5684 }
5685}
@ SPELL_ATTR1_AURA_STAYS_AFTER_COMBAT
Definition SharedDefines.h:455
@ SPELL_ATTR0_CU_IGNORE_EVADE
Definition SpellInfo.h:187

References _UnapplyAura(), AURA_REMOVE_BY_DEFAULT, GetOwnerGUID(), Aura::GetSpellInfo(), SpellInfo::HasAttribute(), SpellInfo::HasAura(), Aura::IsPassive(), ObjectGuid::IsPlayer(), m_appliedAuras, m_ownedAuras, RemoveOwnedAura(), SPELL_ATTR0_CU_IGNORE_EVADE, SPELL_ATTR1_AURA_STAYS_AFTER_COMBAT, SPELL_AURA_CLONE_CASTER, and SPELL_AURA_CONTROL_VEHICLE.

Referenced by CreatureAI::_EnterEvadeMode(), and npc_pos_freed_slave::npc_pos_freed_slaveAI::EnterEvadeMode().

◆ RemoveExtraUnitMovementFlag()

void Unit::RemoveExtraUnitMovementFlag ( uint16  f)
inline

◆ removeFollower()

void Unit::removeFollower ( FollowerReference )
inline
1878{ /* nothing to do yet */ }

Referenced by FollowerReference::targetObjectDestroyLink().

◆ RemoveFromWorld()

void Unit::RemoveFromWorld ( )
overridevirtual

Reimplemented from Object.

12693{
12694 // cleanup
12695 ASSERT(GetGUID());
12696
12697 if (IsInWorld())
12698 {
12700 if (IsVehicle())
12702
12706
12709
12710 ExitVehicle(); // Remove applied auras with SPELL_AURA_CONTROL_VEHICLE
12713
12715
12716 if (GetCharmerGUID())
12717 {
12718 LOG_FATAL("entities.unit", "Unit {} has charmer guid when removed from world", GetEntry());
12719 ABORT();
12720 }
12721
12722 if (Unit* owner = GetOwner())
12723 {
12724 if (owner->m_Controlled.find(this) != owner->m_Controlled.end())
12725 {
12727 owner->SetMinion((Minion*)this, false);
12728 LOG_INFO("entities.unit", "Unit {} is in controlled list of {} when removed from world", GetEntry(), owner->GetEntry());
12729 //ABORT();
12730 }
12731 }
12732
12735 }
12736}
void RemoveNotOwnSingleTargetAuras()
Definition Unit.cpp:5370
void UnsummonAllTotems(bool onDeath=false)
Definition Unit.cpp:8197
void RemoveAllDynObjects()
Definition Unit.cpp:6496
void RemoveAreaAurasDueToLeaveWorld()
Definition Unit.cpp:5511
void RemoveBindSightAuras()
Definition Unit.cpp:8184
void RemoveAllControlled(bool onDeath=false)
Definition Unit.cpp:8081
void RemoveFromWorld() override
Definition Object.cpp:1200

References ABORT, ASSERT, ExitVehicle(), GetCharmerGUID(), Object::GetEntry(), Object::GetGUID(), GetOwner(), HasUnitTypeMask(), Object::IsInWorld(), IsVehicle(), LOG_FATAL, LOG_INFO, m_duringRemoveFromWorld, RemoveAllControlled(), RemoveAllDynObjects(), RemoveAllGameObjects(), RemoveAreaAurasDueToLeaveWorld(), RemoveBindSightAuras(), RemoveCharmAuras(), WorldObject::RemoveFromWorld(), RemoveNotOwnSingleTargetAuras(), RemoveVehicleKit(), UNIT_MASK_GUARDIAN, UNIT_MASK_MINION, and UnsummonAllTotems().

Referenced by CleanupBeforeRemoveFromMap(), Creature::RemoveFromWorld(), Pet::RemoveFromWorld(), and Player::RemoveFromWorld().

◆ RemoveGameObject() [1/2]

void Unit::RemoveGameObject ( GameObject gameObj,
bool  del 
)
6531{
6532 if (!gameObj || gameObj->GetOwnerGUID() != GetGUID())
6533 return;
6534
6536
6537 for (uint8 i = 0; i < MAX_GAMEOBJECT_SLOT; ++i)
6538 {
6539 if (m_ObjectSlot[i] == gameObj->GetGUID())
6540 {
6541 m_ObjectSlot[i].Clear();
6542 break;
6543 }
6544 }
6545
6546 // GO created by some spell
6547 if (uint32 spellid = gameObj->GetSpellId())
6548 {
6549 RemoveAurasDueToSpell(spellid);
6550
6551 if (IsPlayer())
6552 {
6553 SpellInfo const* createBySpell = sSpellMgr->GetSpellInfo(spellid);
6554 // Need activate spell use for owner
6555 if (createBySpell && createBySpell->IsCooldownStartedOnEvent())
6556 // note: item based cooldowns and cooldown spell mods with charges ignored (unknown existing cases)
6557 ToPlayer()->SendCooldownEvent(createBySpell);
6558 }
6559 }
6560
6561 m_gameObj.remove(gameObj->GetGUID());
6562
6563 if (del)
6564 {
6565 gameObj->SetRespawnTime(0);
6566 gameObj->Delete();
6567 }
6568}
void Clear()
Definition ObjectGuid.h:138
void SendCooldownEvent(SpellInfo const *spellInfo, uint32 itemId=0, Spell *spell=nullptr, bool setCooldown=true)
Definition Player.cpp:11048

References ObjectGuid::Clear(), GameObject::Delete(), ObjectGuid::Empty, Object::GetGUID(), Object::GetGUID(), GameObject::GetOwnerGUID(), GameObject::GetSpellId(), SpellInfo::IsCooldownStartedOnEvent(), Object::IsPlayer(), m_gameObj, m_ObjectSlot, MAX_GAMEOBJECT_SLOT, RemoveAurasDueToSpell(), Player::SendCooldownEvent(), GameObject::SetOwnerGUID(), GameObject::SetRespawnTime(), sSpellMgr, and Object::ToPlayer().

Referenced by Spell::cancel(), npc_death_knight_initiate::npc_death_knight_initiateAI::DamageTaken(), Spell::EffectSummonObject(), gobject_commandscript::HandleGameObjectDeleteCommand(), spell_warl_demonic_circle_summon::HandleRemove(), boss_kologarn::JustDied(), npc_ulduar_harpoonfirestate::SetData(), GameObject::Update(), and npc_death_knight_initiate::npc_death_knight_initiateAI::UpdateAI().

◆ RemoveGameObject() [2/2]

void Unit::RemoveGameObject ( uint32  spellid,
bool  del 
)
6571{
6572 if (m_gameObj.empty())
6573 return;
6574
6575 for (GameObjectList::iterator itr = m_gameObj.begin(); itr != m_gameObj.end();)
6576 {
6577 if (GameObject* go = ObjectAccessor::GetGameObject(*this, *itr))
6578 {
6579 if (spellid > 0 && go->GetSpellId() != spellid)
6580 {
6581 ++itr;
6582 continue;
6583 }
6584
6585 go->SetOwnerGUID(ObjectGuid::Empty);
6586 if (del)
6587 {
6588 go->SetRespawnTime(0);
6589 go->Delete();
6590 }
6591 }
6592 m_gameObj.erase(itr++);
6593 }
6594}

References ObjectGuid::Empty, ObjectAccessor::GetGameObject(), and m_gameObj.

◆ removeHatedBy()

void Unit::removeHatedBy ( HostileReference )
inline
950{ /* nothing to do yet */ }

Referenced by HostileReference::targetObjectDestroyLink().

◆ RemoveMovementImpairingAuras()

void Unit::RemoveMovementImpairingAuras ( bool  withRoot)
5460{
5461 if (withRoot)
5463
5464 // Snares
5465 for (AuraApplicationMap::iterator iter = m_appliedAuras.begin(); iter != m_appliedAuras.end();)
5466 {
5467 Aura const* aura = iter->second->GetBase();
5469 {
5470 RemoveAura(iter);
5471 continue;
5472 }
5473
5474 ++iter;
5475 }
5476}
bool HasEffectMechanic(Mechanics mechanic) const
Definition SpellInfo.cpp:884
void RemoveAurasWithMechanic(uint32 mechanic_mask, AuraRemoveMode removemode=AURA_REMOVE_BY_DEFAULT, uint32 except=0)
Definition Unit.cpp:5478

References Aura::GetSpellInfo(), SpellInfo::HasEffectMechanic(), m_appliedAuras, SpellInfo::Mechanic, MECHANIC_ROOT, MECHANIC_SNARE, RemoveAura(), and RemoveAurasWithMechanic().

Referenced by Spell::CheckCast(), Spell::EffectTriggerSpell(), AuraEffect::HandleModMechanicImmunity(), spell_pri_improved_shadowform::HandleProc(), spell_pri_imp_shadowform::HandleProc(), and spell_gen_remove_impairing_auras::HandleScriptEffect().

◆ RemoveNotOwnSingleTargetAuras()

void Unit::RemoveNotOwnSingleTargetAuras ( )
5371{
5372 // single target auras from other casters
5373 // Iterate m_ownedAuras - aura is marked as single target in Unit::AddAura (and pushed to m_ownedAuras).
5374 // m_appliedAuras will NOT contain the aura before first Unit::Update after adding it to m_ownedAuras.
5375 // Quickly removing such an aura will lead to it not being unregistered from caster's single cast auras container
5376 // leading to assertion failures if the aura was cast on a player that can
5377 // (and is changing map at the point where this function is called).
5378 // Such situation occurs when player is logging in inside an instance and fails the entry check for any reason.
5379 // The aura that was loaded from db (indirectly, via linked casts) gets removed before it has a chance
5380 // to register in m_appliedAuras
5381 for (AuraMap::iterator iter = m_ownedAuras.begin(); iter != m_ownedAuras.end();)
5382 {
5383 Aura const* aura = iter->second;
5384
5385 if (aura->GetCasterGUID() != GetGUID() && aura->IsSingleTarget())
5386 RemoveOwnedAura(iter);
5387 else
5388 ++iter;
5389 }
5390
5391 // single target auras at other targets
5392 AuraList& scAuras = GetSingleCastAuras();
5393 for (AuraList::iterator iter = scAuras.begin(); iter != scAuras.end();)
5394 {
5395 Aura* aura = *iter;
5396 if (aura->GetUnitOwner() != this)
5397 {
5398 aura->Remove();
5399 iter = scAuras.begin();
5400 }
5401 else
5402 ++iter;
5403 }
5404}

References Aura::GetCasterGUID(), Object::GetGUID(), GetSingleCastAuras(), Aura::GetUnitOwner(), Aura::IsSingleTarget(), m_ownedAuras, Aura::Remove(), and RemoveOwnedAura().

Referenced by RemoveFromWorld().

◆ RemoveNpcFlag()

void Unit::RemoveNpcFlag ( NPCFlags  flags)
inline
759{ RemoveFlag(UNIT_NPC_FLAGS, flags); }

References Object::RemoveFlag(), and UNIT_NPC_FLAGS.

Referenced by Vehicle::AddPassenger(), boss_vaelastrasz::boss_vaelAI::BeginSpeech(), npc_riggle_bassbait::npc_riggle_bassbaitAI::CheckTournamentState(), npc_fos_leader::npc_fos_leaderAI::DoAction(), npc_thrall_warchief::npc_thrall_warchiefAI::DoAction(), npc_high_overlord_saurfang_icc::npc_high_overlord_saurfangAI::DoAction(), npc_muradin_bronzebeard_icc::npc_muradin_bronzebeard_iccAI::DoAction(), npc_akama_illidan::DoAction(), npc_battle_at_valhalas::npc_battle_at_valhalasAI::EndBattle(), spell_q12096_q12092_dummy::HandleDummy(), npc_hyjal_jaina::hyjalJainaAI::IsSummonedBy(), npc_precious::npc_preciousAI::JustEngagedWith(), npc_artorius::npc_artoriusAI::JustEngagedWith(), npc_simone::npc_simoneAI::JustEngagedWith(), npc_nelson::npc_nelsonAI::JustEngagedWith(), npc_franklin::npc_franklinAI::JustEngagedWith(), npc_akama_illidan::JustReachedHome(), npc_fos_leader_second::npc_fos_leader_secondAI::npc_fos_leader_secondAI(), npc_pos_leader_second::npc_pos_leader_secondAI::npc_pos_leader_secondAI(), npc_chesspiece::OnCharmed(), instance_halls_of_reflection::instance_halls_of_reflection_InstanceMapScript::OnCreatureCreate(), instance_serpent_shrine::instance_serpentshrine_cavern_InstanceMapScript::OnCreatureCreate(), npc_announcer_toc10::OnGossipHello(), npc_hyjal_jaina::OnGossipSelect(), npc_hyjal_thrall::OnGossipSelect(), boss_doomrel::OnGossipSelect(), boss_majordomo::OnGossipSelect(), npc_zulaman_hostage::OnGossipSelect(), npc_arthas::OnGossipSelect(), npc_ulduar_keeper::OnGossipSelect(), npc_announcer_toc5::OnGossipSelect(), npc_announcer_toc10::OnGossipSelect(), npc_hor_leader::OnGossipSelect(), npc_ulduar_expedition_commander::OnGossipSelect(), npc_thrall_old_hillsbrad::OnGossipSelect(), npc_hor_leader_second::OnGossipSelect(), npc_battle_at_valhalas::OnQuestAccept(), npc_riggle_bassbait::OnQuestReward(), boss_flame_leviathan_overload_device::OnSpellClick(), NPCStaveQuestAI::PrepareForEncounter(), RemoveVehicleKit(), boss_majordomo::boss_majordomoAI::Reset(), npc_arthas::npc_arthasAI::Reset(), npc_plucky::npc_pluckyAI::Reset(), npc_xerestrasza::npc_xerestraszaAI::Reset(), npc_tirion_fordring_tft::npc_tirion_fordringAI::Reset(), npc_lake_frog::npc_lake_frogAI::Reset(), npc_akama_illidan::Reset(), npc_akama_shade::Reset(), npc_aeranas::npc_aeranasAI::Reset(), npc_magister_aledis::Reset(), npc_chicken_cluck::npc_chicken_cluckAI::Reset(), instance_violet_hold::instance_violet_hold_InstanceMapScript::SetData(), npc_tirion_fordring_tft::npc_tirion_fordringAI::sGossipSelect(), npc_high_overlord_saurfang_igb::npc_high_overlord_saurfang_igbAI::sGossipSelect(), npc_muradin_bronzebeard_igb::npc_muradin_bronzebeard_igbAI::sGossipSelect(), boss_apothecary_hummel::boss_apothecary_hummelAI::sGossipSelect(), boss_victor_nefarius::boss_victor_nefariusAI::sGossipSelect(), npc_harrison_jones::sGossipSelect(), npc_general_andorov::sGossipSelect(), npc_akama_shade::sGossipSelect(), npc_isle_of_conquest_turret::npc_isle_of_conquest_turretAI::SpellHit(), npc_chesspiece::SpellHitTarget(), npc_belnistrasz::npc_belnistraszAI::sQuestAccept(), npc_deathstalker_fearleia::sQuestAccept(), npc_battle_at_valhalas::npc_battle_at_valhalasAI::StartBattle(), npc_koltira_deathweaver::npc_koltira_deathweaverAI::StartEvent(), npc_magister_aledis::StartFight(), npc_cork_gizelton::npc_cork_gizeltonAI::SummonHelpers(), npc_plucky::npc_pluckyAI::UpdateAI(), npc_lake_frog::npc_lake_frogAI::UpdateAI(), npc_crusade_recruit::npc_crusade_recruitAI::UpdateAI(), and Vehicle::Vehicle().

◆ RemoveOwnedAura() [1/3]

void Unit::RemoveOwnedAura ( Aura aura,
AuraRemoveMode  removeMode = AURA_REMOVE_BY_DEFAULT 
)
4957{
4958 if (aura->IsRemoved())
4959 return;
4960
4961 ASSERT(aura->GetOwner() == this);
4962
4963 uint32 spellId = aura->GetId();
4964 AuraMapBoundsNonConst range = m_ownedAuras.equal_range(spellId);
4965
4966 for (AuraMap::iterator itr = range.first; itr != range.second; ++itr)
4967 {
4968 if (itr->second == aura)
4969 {
4970 RemoveOwnedAura(itr, removeMode);
4971 return;
4972 }
4973 }
4974
4975 ABORT();
4976}

References ABORT, ASSERT, Aura::GetId(), Aura::GetOwner(), Aura::IsRemoved(), m_ownedAuras, and RemoveOwnedAura().

◆ RemoveOwnedAura() [2/3]

void Unit::RemoveOwnedAura ( AuraMap::iterator &  i,
AuraRemoveMode  removeMode = AURA_REMOVE_BY_DEFAULT 
)
4924{
4925 Aura* aura = i->second;
4926 ASSERT(!aura->IsRemoved());
4927
4928 // if unit currently update aura list then make safe update iterator shift to next
4931
4932 m_ownedAuras.erase(i);
4933 m_removedAuras.push_back(aura);
4934
4935 // Unregister single target aura
4936 if (aura->IsSingleTarget())
4937 aura->UnregisterSingleTarget();
4938
4939 aura->_Remove(removeMode);
4940
4941 i = m_ownedAuras.begin();
4942}
void _Remove(AuraRemoveMode removeMode)
Definition SpellAuras.cpp:513

References Aura::_Remove(), ASSERT, Aura::IsRemoved(), Aura::IsSingleTarget(), m_auraUpdateIterator, m_ownedAuras, m_removedAuras, and Aura::UnregisterSingleTarget().

Referenced by Player::_removeTalentAurasAndSpells(), _UpdateSpells(), Player::ActivateSpec(), Spell::EffectApplyGlyph(), WorldSession::HandleCancelAuraOpcode(), spell_pal_improved_aura::HandleEffectApply(), spell_pal_aura_mastery::HandleEffectRemove(), spell_pal_improved_aura::HandleEffectRemove(), WorldSession::HandlePetCancelAuraOpcode(), WorldSession::HandleRemoveGlyph(), AuraEffect::HandleShapeshiftBoosts(), boss_zuljin::JustEngagedWith(), spell_gen_animal_blood::OnApply(), spell_contagion_of_rot::OnApply(), UnitAura::Remove(), RemoveAllAuras(), RemoveAllAurasExceptType(), RemoveAllAurasOnDeath(), RemoveAllAurasRequiringDeadTarget(), RemoveAurasDueToItemSpell(), RemoveEvadeAuras(), Player::RemoveItemDependentAurasAndCasts(), RemoveNotOwnSingleTargetAuras(), RemoveOwnedAura(), RemoveOwnedAura(), RemoveOwnedAuras(), RemoveOwnedAuras(), Player::removeSpell(), boss_falric::boss_falricAI::UpdateAI(), and Player::UpdateAreaDependentAuras().

◆ RemoveOwnedAura() [3/3]

void Unit::RemoveOwnedAura ( uint32  spellId,
ObjectGuid  casterGUID = ObjectGuid::Empty,
uint8  reqEffMask = 0,
AuraRemoveMode  removeMode = AURA_REMOVE_BY_DEFAULT 
)
4945{
4946 for (AuraMap::iterator itr = m_ownedAuras.lower_bound(spellId); itr != m_ownedAuras.upper_bound(spellId);)
4947 if (((itr->second->GetEffectMask() & reqEffMask) == reqEffMask) && (!casterGUID || itr->second->GetCasterGUID() == casterGUID))
4948 {
4949 RemoveOwnedAura(itr, removeMode);
4950 itr = m_ownedAuras.lower_bound(spellId);
4951 }
4952 else
4953 ++itr;
4954}

References m_ownedAuras, and RemoveOwnedAura().

◆ RemoveOwnedAuras() [1/2]

void Unit::RemoveOwnedAuras ( std::function< bool(Aura const *)> const &  check)
5076{
5077 for (AuraMap::iterator iter = m_ownedAuras.begin(); iter != m_ownedAuras.end();)
5078 {
5079 if (check(iter->second))
5080 {
5081 RemoveOwnedAura(iter);
5082 continue;
5083 }
5084 ++iter;
5085 }
5086}

References m_ownedAuras, and RemoveOwnedAura().

Referenced by _RemoveNoStackAurasDueToAura().

◆ RemoveOwnedAuras() [2/2]

void Unit::RemoveOwnedAuras ( uint32  spellId,
std::function< bool(Aura const *)> const &  check 
)
5102{
5103 for (AuraMap::iterator iter = m_ownedAuras.lower_bound(spellId); iter != m_ownedAuras.upper_bound(spellId);)
5104 {
5105 if (check(iter->second))
5106 {
5107 RemoveOwnedAura(iter);
5108 continue;
5109 }
5110 ++iter;
5111 }
5112}

References m_ownedAuras, and RemoveOwnedAura().

◆ RemovePetAura()

void Unit::RemovePetAura ( PetAura const *  petSpell)
13824{
13825 if (!IsPlayer())
13826 return;
13827
13828 m_petAuras.erase(petSpell);
13829 if (Pet* pet = ToPlayer()->GetPet())
13830 pet->RemoveAurasDueToSpell(petSpell->GetAura(pet->GetEntry()));
13831 if (Unit* charm = GetCharm())
13832 charm->RemoveAurasDueToSpell(petSpell->GetAura(charm->GetEntry()));
13833}

References PetAura::GetAura(), GetCharm(), Object::IsPlayer(), m_petAuras, and Object::ToPlayer().

Referenced by Player::_removeTalentAurasAndSpells(), Pet::CastPetAuras(), AuraEffect::HandleAuraDummy(), and Player::removeSpell().

◆ RemovePlayerFromVision()

void Unit::RemovePlayerFromVision ( Player player)
Todo:
: This isn't right, if a previously active object was set to active with e.g. Mind Vision this will make them no longer active
8175{
8176 m_sharedVision.remove(player);
8177 player->m_isInSharedVisionOf.erase(this);
8178
8180 if (m_sharedVision.empty())
8181 setActive(false);
8182}

References Player::m_isInSharedVisionOf, m_sharedVision, and WorldObject::setActive().

Referenced by Player::SetViewpoint(), and Player::~Player().

◆ RemovePointedBy()

void Unit::RemovePointedBy ( SafeUnitPointer sup)
inline

◆ RemoveStandFlags()

void Unit::RemoveStandFlags ( uint8  flags)
inline
@ UNIT_BYTES_1_OFFSET_VIS_FLAG
Definition UnitDefines.h:25
void RemoveByteFlag(uint16 index, uint8 offset, uint8 newFlag)
Definition Object.cpp:912

References Object::RemoveByteFlag(), UNIT_BYTES_1_OFFSET_VIS_FLAG, and UNIT_FIELD_BYTES_1.

Referenced by AuraEffect::HandleModStealth(), Player::InitStatsForLevel(), and npc_varian_wrynn::npc_varian_wrynnAI::UpdateAI().

◆ RemoveUnitFlag()

void Unit::RemoveUnitFlag ( UnitFlags  flags)
inline

UnitFlags available in UnitDefines.h.

743{ RemoveFlag(UNIT_FIELD_FLAGS, flags); }

References Object::RemoveFlag(), and UNIT_FIELD_FLAGS.

Referenced by at_hol_hall_of_watchers::_OnTrigger(), spell_the_lich_king_trigger_vile_spirit::ActivateSpirit(), Player::BuildPlayerRepop(), boss_thekal::CheckPhaseTransition(), Player::CleanupAfterTaxiFlight(), ClearInCombat(), ClearInPetCombat(), boss_alar::DamageTaken(), DisableRotate(), boss_thorim::DisableThorim(), Dismount(), boss_dorothee::DoAction(), boss_roar::DoAction(), boss_strawman::DoAction(), boss_tinhead::DoAction(), boss_thekal::DoAction(), npc_twilight_volunteer::DoAction(), boss_taldaram::DoAction(), boss_prince_keleseth_icc::boss_prince_kelesethAI::DoAction(), boss_prince_taldaram_icc::boss_prince_taldaramAI::DoAction(), boss_prince_valanar_icc::boss_prince_valanarAI::DoAction(), npc_high_overlord_saurfang_icc::npc_high_overlord_saurfangAI::DoAction(), npc_muradin_bronzebeard_icc::npc_muradin_bronzebeard_iccAI::DoAction(), npc_living_constellation::DoAction(), boss_the_lurker_below::DoAction(), npc_frozen_core::DoAction(), boss_broggok::DoAction(), instance_karazhan::instance_karazhan_InstanceMapScript::DoAction(), boss_cthun::DoAction(), boss_grand_champion::boss_grand_championAI::DoAction(), boss_tyrannus::boss_tyrannusAI::DoAction(), npc_xt002_heart::DoAction(), npc_massive_jormungar::npc_massive_jormungarAI::DoAction(), npc_ferocious_rhino::npc_ferocious_rhinoAI::DoAction(), npc_ravenous_furbolg::npc_ravenous_furbolgAI::DoAction(), npc_frenzied_worgen::npc_frenzied_worgenAI::DoAction(), boss_skadi::boss_skadiAI::DoAction(), boss_illidan_stormrage::DoAction(), boss_essence_of_suffering::boss_essence_of_sufferingAI::DoAction(), boss_essence_of_desire::boss_essence_of_desireAI::DoAction(), boss_essence_of_anger::boss_essence_of_angerAI::DoAction(), boss_kelidan_the_breaker::DoAction(), boss_ichoron::boss_ichoronAI::DoExplodeCompleted(), HomeMovementGenerator< Creature >::DoFinalize(), ConfusedMovementGenerator< T >::DoFinalize(), FlightPathMovementGenerator::DoFinalize(), FleeingMovementGenerator< T >::DoFinalize(), ConfusedMovementGenerator< T >::DoFinalize(), WorldSession::DoLootRelease(), Spell::EffectResurrectPet(), Spell::EffectSkinning(), npc_giant_claw_tentacle::Emerge(), boss_ahune::Emerge(), boss_yoggsaron_sara::EnableSara(), boss_bronjahm::boss_bronjahmAI::EnterEvadeMode(), npc_ghostly_priest::npc_ghostly_priestAI::EnterEvadeMode(), npc_phantom_mage::npc_phantom_mageAI::EnterEvadeMode(), npc_shadowy_mercenary::npc_shadowy_mercenaryAI::EnterEvadeMode(), npc_spectral_footman::npc_spectral_footmanAI::EnterEvadeMode(), npc_tortured_rifleman::npc_tortured_riflemanAI::EnterEvadeMode(), boss_kelthuzad::boss_kelthuzadAI::EnterEvadeMode(), boss_malygos::EnterEvadeMode(), boss_ymiron::boss_ymironAI::EnterEvadeMode(), npc_overlord_drakuru_betrayal::EnterEvadeMode(), SmartAI::EnterEvadeMode(), npc_future_you::npc_future_youAI::EnterEvadeMode(), SACActivateEvent::Execute(), boss_ingvar_the_plunderer::FeignDeath(), TimedFleeingMovementGenerator::Finalize(), npc_torloth_the_magnificent::npc_torloth_the_magnificentAI::HandleAnimation(), AuraEffect::HandleArenaPreparation(), AuraEffect::HandleAuraModFaction(), AuraEffect::HandleAuraModPacify(), AuraEffect::HandleAuraModSilence(), spell_q13007_iron_colossus::HandleDummy(), spell_gen_model_visible::HandleEffectRemove(), spell_gen_feign_death_all_flags::HandleEffectRemove(), spell_gen_feign_death_no_dyn_flag::HandleEffectRemove(), spell_gen_feign_death_no_prevent_emotes::HandleEffectRemove(), boss_ragnaros::boss_ragnarosAI::HandleEmerge(), AuraEffect::HandleFeignDeath(), WorldSession::HandleLogoutCancelOpcode(), spell_oculus_drake_flag_aura::HandleOnEffectApply(), spell_oculus_rider_aura::HandleOnEffectRemove(), WorldSession::HandlePlayerLoginToCharInWorld(), spell_boss_magus_telestra_summon_telestra_clones_aura::HandleRemove(), boss_vaelastrasz::boss_vaelAI::Initialize(), boss_kiljaeden::InitializeAI(), boss_jarien::IsSummonedBy(), boss_sothos::IsSummonedBy(), boss_apothecary_hummel::boss_apothecary_hummelAI::JustDied(), boss_volazj::JustDied(), boss_ichoron::boss_ichoronAI::JustDied(), boss_taerar::boss_taerarAI::JustDied(), boss_noth::boss_nothAI::JustDied(), boss_ymiron::boss_ymironAI::JustEngagedWith(), boss_novos::JustEngagedWith(), boss_hazzarah::JustSummoned(), npc_crystalline_frayer::LeaveSeedPod(), boss_anubarak_trial::boss_anubarak_trialAI::MoveInLineOfSight(), boss_taldaram::MovementInform(), boss_grand_champion::boss_grand_championAI::MovementInform(), boss_illidan_stormrage::MovementInform(), boss_sindragosa::boss_sindragosaAI::MovementInform(), boss_shade_of_akama::MovementInform(), boss_kaelthas::MovementInform(), boss_sartharion_dragonAI::MovementInform(), boss_jedoga_shadowseeker::MovementInform(), npc_toc5_player_vehicle::npc_toc5_player_vehicleAI::OnCharmed(), instance_dire_maul::instance_dire_maul_InstanceMapScript::OnCreatureCreate(), npc_death_knight_initiate::OnGossipSelect(), npc_bessy::OnQuestAccept(), spell_halion_twilight_phasing_aura::OnRemove(), boss_nightbane::PathEndReached(), boss_nefarian::PathEndReached(), RemoveCharmedBy(), Vehicle::RemovePassenger(), boss_keristrasza::RemovePrison(), boss_lord_valthalak::boss_lord_valthalakAI::Reset(), boss_rend_blackhand::boss_rend_blackhandAI::Reset(), boss_victor_nefarius::boss_victor_nefariusAI::Reset(), boss_ragnaros::boss_ragnarosAI::Reset(), boss_mr_smite::boss_mr_smiteAI::Reset(), boss_crone::Reset(), boss_julianne::Reset(), boss_apothecary_hummel::boss_apothecary_hummelAI::Reset(), boss_kalecgos::Reset(), boss_kiljaeden::Reset(), boss_muru::Reset(), npc_harrison_jones::Reset(), npc_amanishi_lookout::Reset(), boss_eye_of_cthun::Reset(), boss_volazj::Reset(), boss_anub_arak::Reset(), boss_sartharion_dragonAI::Reset(), boss_general_zarithrian::boss_general_zarithrianAI::Reset(), boss_grand_champion::boss_grand_championAI::Reset(), boss_novos::Reset(), boss_bronjahm::boss_bronjahmAI::Reset(), boss_drakkari_colossus::boss_drakkari_colossusAI::Reset(), boss_professor_putricide::boss_professor_putricideAI::Reset(), boss_gothik::boss_gothikAI::Reset(), boss_kelthuzad::boss_kelthuzadAI::Reset(), boss_malygos::Reset(), npc_crystalline_frayer::Reset(), boss_eregos::boss_eregosAI::Reset(), boss_urom::boss_uromAI::Reset(), boss_varos::boss_varosAI::Reset(), boss_flame_leviathan::Reset(), boss_mimiron::Reset(), npc_ulduar_leviathan_mkii::Reset(), boss_xt002::Reset(), boss_ingvar_the_plunderer::Reset(), boss_skadi::boss_skadiAI::Reset(), boss_svala::boss_svalaAI::Reset(), boss_ymiron::boss_ymironAI::Reset(), boss_ichoron::boss_ichoronAI::Reset(), npc_wounded_skirmisher::Reset(), npc_venture_co_straggler::npc_venture_co_stragglerAI::Reset(), npc_overlord_drakuru_betrayal::Reset(), boss_leotheras_the_blind::Reset(), npc_shattered_hand_scout::Reset(), boss_kaelthas::Reset(), advisor_baseAI::Reset(), emerald_dragonAI::Reset(), npc_doctor::npc_doctorAI::Reset(), npc_injured_patient::npc_injured_patientAI::Reset(), Resurrect(), boss_magtheridon::ScheduleCombatEvents(), boss_the_lurker_below::SchedulerPhaseTwo(), Player::SetBeastMaster(), SetCharm(), npc_ulduar_leviathan_mkii::SetData(), npc_ulduar_vx001::SetData(), npc_ulduar_aerial_command_unit::SetData(), Pet::setDeathState(), SetImmuneToNPC(), SetImmuneToPC(), Player::SetIsSpectator(), SetStunned(), SetSwim(), Battlefield::ShowNpc(), npc_black_knight_ghoul::npc_black_knight_ghoulAI::SpellHit(), npc_ulduar_iron_construct::SpellHit(), npc_ulduar_leviathan_mkii::SpellHit(), npc_ulduar_vx001::SpellHit(), npc_ulduar_aerial_command_unit::SpellHit(), npc_infernal_attacker::npc_infernal_attackerAI::SpellHit(), npc_draenei_survivor::npc_draenei_survivorAI::SpellHit(), advisor_baseAI::SpellHit(), npc_nether_drake::npc_nether_drakeAI::SpellHit(), npc_injured_patient::npc_injured_patientAI::SpellHit(), boss_headless_horseman_head::SpellHit(), boss_black_knight::boss_black_knightAI::SpellHitTarget(), instance_violet_hold::instance_violet_hold_InstanceMapScript::StartBossEncounter(), boss_lord_valthalak::boss_lord_valthalakAI::StartFighting(), boss_noth::boss_nothAI::StartGroundPhase(), boss_drakkari_colossus::boss_drakkari_colossusAI::SummonedCreatureDespawn(), boss_pyroguard_emberseer::boss_pyroguard_emberseerAI::UpdateAI(), boss_vaelastrasz::boss_vaelAI::UpdateAI(), boss_ragnaros::boss_ragnarosAI::UpdateAI(), boss_mr_smite::boss_mr_smiteAI::UpdateAI(), npc_scarlet_ghoul::npc_scarlet_ghoulAI::UpdateAI(), boss_kirtonos_the_herald::boss_kirtonos_the_heraldAI::UpdateAI(), boss_arlokk::boss_arlokkAI::UpdateAI(), npc_twiggy_flathead::npc_twiggy_flatheadAI::UpdateAI(), boss_volazj::UpdateAI(), boss_anub_arak::UpdateAI(), npc_memory::npc_memoryAI::UpdateAI(), boss_anubarak_trial::boss_anubarak_trialAI::UpdateAI(), npc_nerubian_burrower::npc_nerubian_burrowerAI::UpdateAI(), boss_jormungarAI::UpdateAI(), boss_drakkari_colossus::boss_drakkari_colossusAI::UpdateAI(), npc_cult_fanatic::npc_cult_fanaticAI::UpdateAI(), npc_cult_adherent::npc_cult_adherentAI::UpdateAI(), npc_valkyr_shadowguard::npc_valkyr_shadowguardAI::UpdateAI(), npc_crok_scourgebane::npc_crok_scourgebaneAI::UpdateAI(), boss_gothik::boss_gothikAI::UpdateAI(), boss_kelthuzad::boss_kelthuzadAI::UpdateAI(), boss_sapphiron::boss_sapphironAI::UpdateAI(), boss_thaddius::boss_thaddiusAI::UpdateAI(), boss_malygos::UpdateAI(), boss_urom::boss_uromAI::UpdateAI(), boss_algalon_the_observer::UpdateAI(), boss_flame_leviathan::UpdateAI(), boss_mimiron::UpdateAI(), boss_xt002::UpdateAI(), boss_ingvar_the_plunderer::UpdateAI(), npc_vrykul_skeleton::UpdateAI(), boss_palehoof::boss_palehoofAI::UpdateAI(), boss_svala::boss_svalaAI::UpdateAI(), boss_ymiron::boss_ymironAI::UpdateAI(), npc_q24545_vegard::npc_q24545_vegardAI::UpdateAI(), boss_taerar::boss_taerarAI::UpdateAI(), npc_artorius::npc_artoriusAI::UpdateAI(), npc_simone::npc_simoneAI::UpdateAI(), npc_nelson::npc_nelsonAI::UpdateAI(), npc_franklin::npc_franklinAI::UpdateAI(), npc_injured_patient::npc_injured_patientAI::UpdateAI(), and npc_general_andorov::WaypointReached().

◆ RemoveUnitFlag2()

◆ RemoveUnitMovementFlag()

◆ RemoveVehicleKit()

void Unit::RemoveVehicleKit ( )
15094{
15095 if (!m_vehicleKit)
15096 return;
15097
15099 delete m_vehicleKit;
15100
15101 m_vehicleKit = nullptr;
15102
15103 m_updateFlag &= ~UPDATEFLAG_VEHICLE;
15104 m_unitTypeMask &= ~UNIT_MASK_VEHICLE;
15106}
@ UNIT_NPC_FLAG_SPELLCLICK
Definition UnitDefines.h:343
@ UNIT_NPC_FLAG_PLAYER_VEHICLE
Definition UnitDefines.h:344
void RemoveNpcFlag(NPCFlags flags)
Definition Unit.h:759

References m_unitTypeMask, Object::m_updateFlag, m_vehicleKit, RemoveNpcFlag(), Vehicle::Uninstall(), UNIT_NPC_FLAG_PLAYER_VEHICLE, and UNIT_NPC_FLAG_SPELLCLICK.

Referenced by Dismount(), AuraEffect::HandleAuraSetVehicle(), npc_gunship::npc_gunshipAI::JustDied(), npc_isle_of_conquest_turret::npc_isle_of_conquest_turretAI::JustDied(), spell_blood_queen_frenzied_bloodthirst_aura::OnRemove(), and RemoveFromWorld().

◆ RemoveVisibleAura()

void Unit::RemoveVisibleAura ( uint8  slot)
inline
1537{ m_visibleAuras.erase(slot); UpdateAuraForGroup(slot);}
void UpdateAuraForGroup(uint8 slot)
Definition Unit.cpp:13683

References m_visibleAuras, and UpdateAuraForGroup().

Referenced by AuraApplication::_Remove().

◆ ReplaceAllDynamicFlags()

◆ ReplaceAllNpcFlags()

void Unit::ReplaceAllNpcFlags ( NPCFlags  flags)
inline

References SetUInt32Value(), and UNIT_NPC_FLAGS.

Referenced by Pet::CreateBaseAtTamed(), npc_wild_wyrm::DamageTaken(), brann_bronzebeard::brann_bronzebeardAI::DoAction(), Spell::EffectSummonType(), SmartAI::EndPath(), modify_commandscript::HandleModifyFactionCommand(), npc_commandscript::HandleNpcSetFlagCommand(), npc_lord_arete::npc_lord_areteAI::InitializeAI(), npc_highlord_darion_mograine::npc_highlord_darion_mograineAI::JustRespawned(), npc_akama_illidan::JustSummoned(), Pet::LoadPetFromDB(), npc_pet_gen_argent_pony_bridle::OnGossipSelect(), npc_shandy_dalaran::OnGossipSelect(), go_crystalline_tear::OnQuestAccept(), boss_yoggsaron_descend_portal::OnSpellClick(), npc_hidden_cultist::npc_hidden_cultistAI::PreScript(), boss_doomrel::boss_doomrelAI::Reset(), npc_eris_hevenfire::npc_eris_hevenfireAI::Reset(), npc_taretha::npc_tarethaAI::Reset(), brann_bronzebeard::brann_bronzebeardAI::Reset(), npc_hidden_cultist::npc_hidden_cultistAI::Reset(), npc_pet_gen_argent_pony_bridle::Reset(), Creature::setDeathState(), npc_eris_hevenfire::npc_eris_hevenfireAI::SetGUID(), npc_captain_saeed::npc_captain_saeedAI::SetGUID(), npc_akama_illidan::sGossipSelect(), npc_escortAI::Start(), FollowerAI::StartFollow(), SmartAI::StartPath(), Player::SummonPet(), npc_highlord_darion_mograine::npc_highlord_darion_mograineAI::UpdateAI(), npc_lord_arete::npc_lord_areteAI::UpdateAI(), npc_pet_gen_argent_pony_bridle::UpdateAI(), Creature::UpdateEntry(), brann_bronzebeard::brann_bronzebeardAI::UpdateEscortAI(), GameEventMgr::UpdateEventNPCFlags(), and npc_captain_saeed::npc_captain_saeedAI::WaypointReached().

◆ ReplaceAllUnitFlags()

◆ ReplaceAllUnitFlags2()

void Unit::ReplaceAllUnitFlags2 ( UnitFlags2  flags)
inline

◆ resetAttackTimer()

◆ ResetRedirectThreat()

◆ RespondsToCallForHelp()

bool Unit::RespondsToCallForHelp ( ) const
inline
1026 {
1027 if (FactionTemplateEntry const* entry = GetFactionTemplateEntry())
1028 return entry->FactionRespondsToCallForHelp();
1029
1030 return false;
1031 }

References GetFactionTemplateEntry().

Referenced by Creature::CanAssistTo().

◆ RestoreDisplayId()

void Unit::RestoreDisplayId ( )
13278{
13279 AuraEffect* handledAura = nullptr;
13280 AuraEffect* handledAuraForced = nullptr;
13281 // try to receive model from transform auras
13283 if (!transforms.empty())
13284 {
13285 // iterate over already applied transform auras - from newest to oldest
13286 for (auto i = transforms.rbegin(); i != transforms.rend(); ++i)
13287 {
13288 if (AuraApplication const* aurApp = (*i)->GetBase()->GetApplicationOfTarget(GetGUID()))
13289 {
13290 if (!handledAura)
13291 handledAura = (*i);
13292 // xinef: prefer negative/forced auras
13293 if ((*i)->GetSpellInfo()->HasAttribute(SPELL_ATTR0_NO_IMMUNITIES) || !aurApp->IsPositive())
13294 {
13295 handledAuraForced = (*i);
13296 break;
13297 }
13298 }
13299 }
13300 }
13301
13302 // Xinef: include clone auras (eg mirror images)
13303 if (!handledAuraForced && !handledAura)
13304 {
13306 if (!cloneAuras.empty())
13307 for (Unit::AuraEffectList::const_iterator i = cloneAuras.begin(); i != cloneAuras.end(); ++i)
13308 handledAura = *i;
13309 }
13310
13312
13313 // xinef: order of execution is important!
13314 // first forced transform auras, then shapeshifts, then normal transform
13315 // transform aura was found
13316 if (handledAuraForced)
13317 {
13318 handledAuraForced->HandleEffect(this, AURA_EFFECT_HANDLE_SEND_FOR_CLIENT, true);
13319 return;
13320 }
13321 else if (!shapeshiftAura.empty()) // we've found shapeshift
13322 {
13323 // only one such aura possible at a time
13324 if (uint32 modelId = GetModelForForm(GetShapeshiftForm(), shapeshiftAura.front()->GetId()))
13325 {
13326 SetDisplayId(modelId);
13327 return;
13328 }
13329 }
13330 else if (handledAura)
13331 {
13332 handledAura->HandleEffect(this, AURA_EFFECT_HANDLE_SEND_FOR_CLIENT, true);
13333 return;
13334 }
13335
13336 // no auras found - set modelid to default
13338}
@ AURA_EFFECT_HANDLE_SEND_FOR_CLIENT
Definition SpellAuraDefines.h:43
void HandleEffect(AuraApplication *aurApp, uint8 mode, bool apply)
Definition SpellAuraEffects.cpp:755
uint32 GetModelForForm(ShapeshiftForm form, uint32 spellId)
Definition Unit.cpp:15564

References AURA_EFFECT_HANDLE_SEND_FOR_CLIENT, Aura::GetApplicationOfTarget(), GetAuraEffectsByType(), AuraApplication::GetBase(), Object::GetGUID(), GetModelForForm(), GetNativeDisplayId(), GetShapeshiftForm(), AuraEffect::HandleEffect(), SetDisplayId(), SPELL_ATTR0_NO_IMMUNITIES, SPELL_AURA_CLONE_CASTER, SPELL_AURA_MOD_SHAPESHIFT, and SPELL_AURA_TRANSFORM.

Referenced by AuraEffect::HandleAuraModShapeshift(), AuraEffect::HandleAuraTransform(), spell_gen_aura_service_uniform::OnRemove(), and Player::SetIsSpectator().

◆ RestoreFaction()

void Unit::RestoreFaction ( )
15062{
15063 if (IsPlayer())
15065 else
15066 {
15068 {
15069 if (Unit* owner = GetOwner())
15070 {
15071 SetFaction(owner->GetFaction());
15072 return;
15073 }
15074 }
15075
15076 if (CreatureTemplate const* cinfo = ToCreature()->GetCreatureTemplate()) // normal creature
15077 SetFaction(cinfo->faction);
15078 }
15079}
void SetFactionForRace(uint8 race)
Definition Player.cpp:5842

References GetOwner(), getRace(), HasUnitTypeMask(), Object::IsPlayer(), SetFaction(), Player::SetFactionForRace(), Object::ToCreature(), Object::ToPlayer(), and UNIT_MASK_MINION.

Referenced by npc_magister_aledis::DamageTaken(), npc_tapoke_slim_jahn::npc_tapoke_slim_jahnAI::DamageTaken(), npc_death_knight_initiate::npc_death_knight_initiateAI::DamageTaken(), boss_thekal::DoAction(), AuraEffect::HandleAuraModFaction(), npc_commandscript::HandleNpcSetOriginalFaction(), npc_enslaved_netherwing_drake::JustDied(), npc_escortAI::JustRespawned(), SmartAI::JustRespawned(), npc_wizzlecrank_shredder::npc_wizzlecrank_shredderAI::JustSummoned(), RemoveCharmedBy(), npc_death_knight_initiate::npc_death_knight_initiateAI::Reset(), npc_marzon_silent_blade::npc_marzon_silent_bladeAI::Reset(), boss_azuregos::boss_azuregosAI::Reset(), npc_ahnqiraji_critter::Reset(), npc_hidden_cultist::npc_hidden_cultistAI::Reset(), npc_magister_aledis::Reset(), npc_captain_saeed::npc_captain_saeedAI::Reset(), npc_bessy::npc_bessyAI::Reset(), and npc_enslaved_netherwing_drake::Reset().

◆ ResumeMovement()

void Unit::ResumeMovement ( uint32  timer = 0,
uint8  slot = 0 
)
13167{
13168 if (slot >= MAX_MOTION_SLOT)
13169 return;
13170
13171 if (MovementGenerator* movementGenerator = GetMotionMaster()->GetMotionSlot(slot))
13172 movementGenerator->Resume(timer);
13173}

References GetMotionMaster(), and MAX_MOTION_SLOT.

Referenced by boss_razuvious::boss_razuviousAI::ScheduleInteractWithDeathKnight(), npc_acherus_necromancer::npc_acherus_necromancerAI::UpdateAI(), and npc_gothik_the_harvester::npc_gothik_the_harvesterAI::UpdateAI().

◆ RewardRage()

void Unit::RewardRage ( uint32  damage,
uint32  weaponSpeedHitFactor,
bool  attacker 
)
16231{
16232 // Rage formulae https://wowwiki-archive.fandom.com/wiki/Rage#Formulae
16233 float addRage;
16234
16235 float rageconversion = ((0.0091107836f * GetLevel() * GetLevel()) + 3.225598133f * GetLevel()) + 4.2652911f;
16236
16237 // Unknown if correct, but lineary adjust rage conversion above level 70
16238 if (GetLevel() > 70)
16239 rageconversion += 13.27f * (GetLevel() - 70);
16240
16241 if (attacker)
16242 {
16243 // see Bornak's bluepost explanation (05/29/2009)
16244 float rageFromDamageDealt = damage / rageconversion * 7.5f;
16245 addRage = (rageFromDamageDealt + weaponSpeedHitFactor) / 2.0f;
16246 addRage = std::min(addRage, rageFromDamageDealt * 2.0f);
16248 }
16249 else
16250 {
16251 addRage = damage / rageconversion * 2.5f;
16252
16253 // Berserker Rage effect
16254 if (HasAura(18499))
16255 addRage *= 3.0f;
16256 }
16257
16258 addRage *= sWorld->getRate(RATE_POWER_RAGE_INCOME);
16259
16260 ModifyPower(POWER_RAGE, uint32(addRage * 10));
16261}
@ SPELL_AURA_MOD_RAGE_FROM_DAMAGE_DEALT
Definition SpellAuraDefines.h:276
@ RATE_POWER_RAGE_INCOME
Definition WorldConfig.h:392

References AddPct(), GetLevel(), GetTotalAuraModifier(), HasAura(), ModifyPower(), POWER_RAGE, RATE_POWER_RAGE_INCOME, SPELL_AURA_MOD_RAGE_FROM_DAMAGE_DEALT, and sWorld.

Referenced by DealDamage(), and DealMeleeDamage().

◆ RollMeleeOutcomeAgainst() [1/2]

MeleeHitOutcome Unit::RollMeleeOutcomeAgainst ( Unit const *  victim,
WeaponAttackType  attType 
) const
2914{
2915 // This is only wrapper
2916
2917 // Miss chance based on melee
2918 //float miss_chance = MeleeMissChanceCalc(victim, attType);
2919 float miss_chance = MeleeSpellMissChance(victim, attType, int32(GetWeaponSkillValue(attType, victim)) - int32(victim->GetMaxSkillValueForLevel(this)), 0);
2920
2921 // Critical hit chance
2922 float crit_chance = GetUnitCriticalChance(attType, victim);
2923 if (crit_chance < 0)
2924 crit_chance = 0;
2925
2926 float dodge_chance = victim->GetUnitDodgeChance();
2927 float block_chance = victim->GetUnitBlockChance();
2928 float parry_chance = victim->GetUnitParryChance();
2929
2930 // Useful if want to specify crit & miss chances for melee, else it could be removed
2931 //LOG_DEBUG("entities.unit", "MELEE OUTCOME: miss {} crit {} dodge {} parry {} block {}", miss_chance, crit_chance, dodge_chance, parry_chance, block_chance);
2932
2933 return RollMeleeOutcomeAgainst(victim, attType, int32(crit_chance * 100), int32(miss_chance * 100), int32(dodge_chance * 100), int32(parry_chance * 100), int32(block_chance * 100));
2934}
float GetUnitCriticalChance(WeaponAttackType attackType, Unit const *victim) const
Definition Unit.cpp:3849

References GetMaxSkillValueForLevel(), GetUnitBlockChance(), GetUnitCriticalChance(), GetUnitDodgeChance(), GetUnitParryChance(), GetWeaponSkillValue(), MeleeSpellMissChance(), and RollMeleeOutcomeAgainst().

Referenced by CalculateMeleeDamage(), and RollMeleeOutcomeAgainst().

◆ RollMeleeOutcomeAgainst() [2/2]

MeleeHitOutcome Unit::RollMeleeOutcomeAgainst ( Unit const *  victim,
WeaponAttackType  attType,
int32  crit_chance,
int32  miss_chance,
int32  dodge_chance,
int32  parry_chance,
int32  block_chance 
) const
2937{
2938 if (victim->IsCreature() && victim->ToCreature()->IsEvadingAttacks())
2939 {
2940 return MELEE_HIT_EVADE;
2941 }
2942
2943 int32 attackerMaxSkillValueForLevel = GetMaxSkillValueForLevel(victim);
2944 int32 victimMaxSkillValueForLevel = victim->GetMaxSkillValueForLevel(this);
2945
2946 int32 attackerWeaponSkill = GetWeaponSkillValue(attType, victim);
2947 int32 victimDefenseSkill = victim->GetDefenseSkillValue(this);
2948
2949 sScriptMgr->OnBeforeRollMeleeOutcomeAgainst(this, victim, attType, attackerMaxSkillValueForLevel, victimMaxSkillValueForLevel, attackerWeaponSkill, victimDefenseSkill, crit_chance, miss_chance, dodge_chance, parry_chance, block_chance);
2950
2951 // bonus from skills is 0.04%
2952 int32 skillBonus = 4 * (attackerWeaponSkill - victimMaxSkillValueForLevel);
2953 int32 sum = 0, tmp = 0;
2954 int32 roll = urand (0, 10000);
2955
2956 LOG_DEBUG("entities.unit", "RollMeleeOutcomeAgainst: skill bonus of {} for attacker", skillBonus);
2957 //LOG_DEBUG("entities.unit", "RollMeleeOutcomeAgainst: rolled {}, miss {}, dodge {}, parry {}, block {}, crit {}",
2958 // roll, miss_chance, dodge_chance, parry_chance, block_chance, crit_chance);
2959
2960 tmp = miss_chance;
2961
2962 if (tmp > 0 && roll < (sum += tmp))
2963 {
2964 LOG_DEBUG("entities.unit", "RollMeleeOutcomeAgainst: MISS");
2965 return MELEE_HIT_MISS;
2966 }
2967
2968 // Dodge chance
2969
2970 // only players can't dodge if attacker is behind
2971 if (victim->IsPlayer() && !victim->HasInArc(M_PI, this) && !victim->HasIgnoreHitDirectionAura())
2972 {
2973 //LOG_DEBUG("entities.unit", "RollMeleeOutcomeAgainst: attack came from behind and victim was a player.");
2974 }
2975 // Xinef: do not allow to dodge with CREATURE_FLAG_EXTRA_NO_DODGE flag
2976 else if (victim->IsPlayer() || !(victim->ToCreature()->HasFlagsExtra(CREATURE_FLAG_EXTRA_NO_DODGE)))
2977 {
2978 // Reduce dodge chance by attacker expertise rating
2979 if (IsPlayer())
2980 dodge_chance -= int32(ToPlayer()->GetExpertiseDodgeOrParryReduction(attType) * 100);
2981 else
2982 dodge_chance -= GetTotalAuraModifier(SPELL_AURA_MOD_EXPERTISE) * 25;
2983
2984 // Modify dodge chance by attacker SPELL_AURA_MOD_COMBAT_RESULT_CHANCE
2986 dodge_chance = int32 (float (dodge_chance) * GetTotalAuraMultiplier(SPELL_AURA_MOD_ENEMY_DODGE));
2987
2988 tmp = dodge_chance;
2989
2990 // xinef: if casting or stunned - cant dodge
2991 if (victim->IsNonMeleeSpellCast(false, false, true) || victim->HasUnitState(UNIT_STATE_CONTROLLED))
2992 tmp = 0;
2993
2994 if ((tmp > 0) // check if unit _can_ dodge
2995 && ((tmp -= skillBonus) > 0)
2996 && roll < (sum += tmp))
2997 {
2998 LOG_DEBUG("entities.unit", "RollMeleeOutcomeAgainst: DODGE <{}, {})", sum - tmp, sum);
2999 return MELEE_HIT_DODGE;
3000 }
3001 }
3002
3003 // parry & block chances
3004
3005 // check if attack comes from behind, nobody can parry or block if attacker is behind
3006 if (!victim->HasInArc(M_PI, this) && !victim->HasIgnoreHitDirectionAura())
3007 {
3008 LOG_DEBUG("entities.unit", "RollMeleeOutcomeAgainst: attack came from behind.");
3009 }
3010 else
3011 {
3012 // Reduce parry chance by attacker expertise rating
3013 if (IsPlayer())
3014 parry_chance -= int32(ToPlayer()->GetExpertiseDodgeOrParryReduction(attType) * 100);
3015 else
3016 parry_chance -= GetTotalAuraModifier(SPELL_AURA_MOD_EXPERTISE) * 25;
3017
3018 if (victim->IsPlayer() || !(victim->ToCreature()->HasFlagsExtra(CREATURE_FLAG_EXTRA_NO_PARRY)))
3019 {
3020 tmp = parry_chance;
3021
3022 // xinef: cant parry while casting or while stunned
3023 if (victim->IsNonMeleeSpellCast(false, false, true) || victim->HasUnitState(UNIT_STATE_CONTROLLED))
3024 tmp = 0;
3025
3026 if (tmp > 0 // check if unit _can_ parry
3027 && (tmp -= skillBonus) > 0
3028 && roll < (sum += tmp))
3029 {
3030 LOG_DEBUG("entities.unit", "RollMeleeOutcomeAgainst: PARRY <{}, {})", sum - tmp, sum);
3031 return MELEE_HIT_PARRY;
3032 }
3033 }
3034
3035 if (victim->IsPlayer() || !(victim->ToCreature()->HasFlagsExtra(CREATURE_FLAG_EXTRA_NO_BLOCK)))
3036 {
3037 tmp = block_chance;
3038
3039 // xinef: cant block while casting or while stunned
3040 if (victim->IsNonMeleeSpellCast(false, false, true) || victim->HasUnitState(UNIT_STATE_CONTROLLED))
3041 tmp = 0;
3042
3043 if (tmp > 0 // check if unit _can_ block
3044 && (tmp -= skillBonus) > 0
3045 && roll < (sum += tmp))
3046 {
3047 LOG_DEBUG("entities.unit", "RollMeleeOutcomeAgainst: BLOCK <{}, {})", sum - tmp, sum);
3048 return MELEE_HIT_BLOCK;
3049 }
3050 }
3051 }
3052
3053 // Max 40% chance to score a glancing blow against mobs that are higher level (can do only players and pets and not with ranged weapon)
3054 if (attType != RANGED_ATTACK &&
3055 (IsPlayer() || IsPet()) &&
3056 !victim->IsPlayer() && !victim->IsPet() &&
3057 GetLevel() < victim->getLevelForTarget(this))
3058 {
3059 // cap possible value (with bonuses > max skill)
3060 int32 skill = attackerWeaponSkill;
3061 int32 maxskill = attackerMaxSkillValueForLevel;
3062 skill = (skill > maxskill) ? maxskill : skill;
3063
3064 tmp = (10 + (victimDefenseSkill - skill)) * 100;
3065 tmp = tmp > 4000 ? 4000 : tmp;
3066 if (roll < (sum += tmp))
3067 {
3068 LOG_DEBUG("entities.unit", "RollMeleeOutcomeAgainst: GLANCING <{}, {})", sum - 4000, sum);
3069 return MELEE_HIT_GLANCING;
3070 }
3071 }
3072
3073 // mobs can score crushing blows if they're 4 or more levels above victim
3074 if (getLevelForTarget(victim) >= victim->getLevelForTarget(this) + 4 &&
3075 // can be from by creature (if can) or from controlled player that considered as creature
3078 {
3079 // when their weapon skill is 15 or more above victim's defense skill
3080 tmp = victimDefenseSkill;
3081 int32 tmpmax = victimMaxSkillValueForLevel;
3082 // having defense above your maximum (from items, talents etc.) has no effect
3083 tmp = tmp > tmpmax ? tmpmax : tmp;
3084 // tmp = mob's level * 5 - player's current defense skill
3085 tmp = attackerMaxSkillValueForLevel - tmp;
3086 if (tmp >= 15)
3087 {
3088 // add 2% chance per lacking skill point, min. is 15%
3089 tmp = tmp * 200 - 1500;
3090 if (roll < (sum += tmp))
3091 {
3092 LOG_DEBUG("entities.unit", "RollMeleeOutcomeAgainst: CRUSHING <{}, {})", sum - tmp, sum);
3093 return MELEE_HIT_CRUSHING;
3094 }
3095 }
3096 }
3097
3098 // Critical chance
3099 tmp = crit_chance;
3100
3101 if (tmp > 0 && roll < (sum += tmp))
3102 {
3103 LOG_DEBUG("entities.unit", "RollMeleeOutcomeAgainst: CRIT <{}, {})", sum - tmp, sum);
3104 if (IsCreature() && (ToCreature()->HasFlagsExtra(CREATURE_FLAG_EXTRA_NO_CRIT)))
3105 LOG_DEBUG("entities.unit", "RollMeleeOutcomeAgainst: CRIT DISABLED)");
3106 else
3107 return MELEE_HIT_CRIT;
3108 }
3109
3110 LOG_DEBUG("entities.unit", "RollMeleeOutcomeAgainst: NORMAL");
3111 return MELEE_HIT_NORMAL;
3112}
@ CREATURE_FLAG_EXTRA_NO_CRUSHING_BLOWS
Definition CreatureData.h:50
@ CREATURE_FLAG_EXTRA_NO_CRIT
Definition CreatureData.h:62

References CREATURE_FLAG_EXTRA_NO_BLOCK, CREATURE_FLAG_EXTRA_NO_CRIT, CREATURE_FLAG_EXTRA_NO_CRUSHING_BLOWS, CREATURE_FLAG_EXTRA_NO_DODGE, CREATURE_FLAG_EXTRA_NO_PARRY, GetDefenseSkillValue(), GetLevel(), getLevelForTarget(), GetMaxSkillValueForLevel(), GetTotalAuraModifier(), GetTotalAuraModifierByMiscValue(), GetTotalAuraMultiplier(), GetWeaponSkillValue(), Creature::HasFlagsExtra(), HasIgnoreHitDirectionAura(), Position::HasInArc(), HasUnitState(), IsControlledByPlayer(), Object::IsCreature(), Creature::IsEvadingAttacks(), IsNonMeleeSpellCast(), IsPet(), Object::IsPlayer(), LOG_DEBUG, MELEE_HIT_BLOCK, MELEE_HIT_CRIT, MELEE_HIT_CRUSHING, MELEE_HIT_DODGE, MELEE_HIT_EVADE, MELEE_HIT_GLANCING, MELEE_HIT_MISS, MELEE_HIT_NORMAL, MELEE_HIT_PARRY, RANGED_ATTACK, SPELL_AURA_MOD_COMBAT_RESULT_CHANCE, SPELL_AURA_MOD_ENEMY_DODGE, SPELL_AURA_MOD_EXPERTISE, sScriptMgr, Object::ToCreature(), Object::ToPlayer(), UNIT_STATE_CONTROLLED, urand(), and VICTIMSTATE_DODGE.

◆ Say() [1/2]

◆ Say() [2/2]

void Unit::Say ( uint32  textId,
WorldObject const *  target = nullptr 
)
virtual

Reimplemented in Player.

17409{
17410 Talk(textId, CHAT_MSG_MONSTER_SAY, sWorld->getFloatConfig(CONFIG_LISTEN_RANGE_SAY), target);
17411}

References CHAT_MSG_MONSTER_SAY, CONFIG_LISTEN_RANGE_SAY, and sWorld.

◆ SelectNearbyNoTotemTarget()

Unit * Unit::SelectNearbyNoTotemTarget ( Unit exclude = nullptr,
float  dist = NOMINAL_MELEE_RANGE 
) const
13522{
13523 std::list<Unit*> targets;
13524 Acore::AnyUnfriendlyNoTotemUnitInObjectRangeCheck u_check(this, this, dist);
13526 Cell::VisitObjects(this, searcher, dist);
13527
13528 // remove current target
13529 if (GetVictim())
13530 targets.remove(GetVictim());
13531
13532 if (exclude)
13533 targets.remove(exclude);
13534
13535 // remove not LoS targets
13536 for (std::list<Unit*>::iterator tIter = targets.begin(); tIter != targets.end();)
13537 {
13538 if (!IsWithinLOSInMap(*tIter) || !IsValidAttackTarget(*tIter))
13539 {
13540 std::list<Unit*>::iterator tIter2 = tIter;
13541 ++tIter;
13542 targets.erase(tIter2);
13543 }
13544 else
13545 ++tIter;
13546 }
13547
13548 // no appropriate targets
13549 if (targets.empty())
13550 return nullptr;
13551
13552 // select random
13554}
bool IsValidAttackTarget(Unit const *target, SpellInfo const *bySpell=nullptr) const
Definition Unit.cpp:10804
auto SelectRandomContainerElement(C const &container) -> typename std::add_const< decltype(*std::begin(container))>::type &
Definition Containers.h:133
Definition GridNotifiers.h:414

References GetVictim(), IsValidAttackTarget(), WorldObject::IsWithinLOSInMap(), Acore::Containers::SelectRandomContainerElement(), and Cell::VisitObjects().

Referenced by spell_rog_blade_flurry::CheckProc(), and spell_warr_sweeping_strikes::CheckProc().

◆ SelectNearbyTarget()

Unit * Unit::SelectNearbyTarget ( Unit exclude = nullptr,
float  dist = NOMINAL_MELEE_RANGE 
) const
13487{
13488 std::list<Unit*> targets;
13489 Acore::AnyUnfriendlyUnitInObjectRangeCheck u_check(this, this, dist);
13491 Cell::VisitObjects(this, searcher, dist);
13492
13493 // remove current target
13494 if (GetVictim())
13495 targets.remove(GetVictim());
13496
13497 if (exclude)
13498 targets.remove(exclude);
13499
13500 // remove not LoS targets
13501 for (std::list<Unit*>::iterator tIter = targets.begin(); tIter != targets.end();)
13502 {
13503 if (!IsWithinLOSInMap(*tIter) || !IsValidAttackTarget(*tIter))
13504 {
13505 std::list<Unit*>::iterator tIter2 = tIter;
13506 ++tIter;
13507 targets.erase(tIter2);
13508 }
13509 else
13510 ++tIter;
13511 }
13512
13513 // no appropriate targets
13514 if (targets.empty())
13515 return nullptr;
13516
13517 // select random
13519}
Definition GridNotifiers.h:852

References GetVictim(), IsValidAttackTarget(), WorldObject::IsWithinLOSInMap(), Acore::Containers::SelectRandomContainerElement(), and Cell::VisitObjects().

Referenced by npc_pet_dk_army_of_the_dead::IsSummonedBy(), boss_yazzai::JustEngagedWith(), npc_highlord_darion_mograine::npc_highlord_darion_mograineAI::JustSummoned(), boss_curator::JustSummoned(), npc_hodirs_fury::UpdateAI(), npc_storm_beacon_spawn::UpdateAI(), boss_kologarn::UpdateAI(), boss_thorim_trap::UpdateAI(), npc_llod_generic::npc_llod_genericAI::UpdateAI(), npc_millhouse_manastorm::npc_millhouse_manastormAI::UpdateAI(), Player::UpdateCharmedAI(), and boss_yoggsaron_cloud::UpdateEscortAI().

◆ SendAttackStateUpdate() [1/2]

void Unit::SendAttackStateUpdate ( CalcDamageInfo damageInfo)

Probably used for debugging purposes, as it is not known to appear on retail servers

6835{
6836 LOG_DEBUG("entities.unit", "WORLD: Sending SMSG_ATTACKERSTATEUPDATE");
6837
6838 uint32 tmpDamage[MAX_ITEM_PROTO_DAMAGES] = { };
6839 uint32 tmpAbsorb[MAX_ITEM_PROTO_DAMAGES] = { };
6840 for (uint8 i = 0; i < MAX_ITEM_PROTO_DAMAGES; ++i)
6841 {
6842 //IF we are in cheat mode we swap absorb with damage and set damage to 0, this way we can still debug damage but our hp bar will not drop
6843 tmpDamage[i] = damageInfo->damages[i].damage;
6844 tmpAbsorb[i] = damageInfo->damages[i].absorb;
6845 if (damageInfo->target->IsPlayer() && damageInfo->target->ToPlayer()->GetCommandStatus(CHEAT_GOD))
6846 {
6847 tmpAbsorb[i] = tmpDamage[i];
6848 tmpDamage[i] = 0;
6849 }
6850 }
6851
6852 uint32 count = 1;
6853 if (tmpDamage[1] || tmpAbsorb[1] || damageInfo->damages[1].resist)
6854 {
6855 ++count;
6856 }
6857
6858 std::size_t const maxsize = 4 + 5 + 5 + 4 + 4 + 1 + count * (4 + 4 + 4 + 4 + 4) + 1 + 4 + 4 + 4 + 4 + 4 * 12;
6859 WorldPacket data(SMSG_ATTACKERSTATEUPDATE, maxsize); // we guess size
6860 data << uint32(damageInfo->HitInfo);
6861 data << damageInfo->attacker->GetPackGUID();
6862 data << damageInfo->target->GetPackGUID();
6863 data << uint32(tmpDamage[0] + tmpDamage[1]); // Full damage
6864 int32 overkill = tmpDamage[0] + tmpDamage[1] - damageInfo->target->GetHealth();
6865 data << uint32(overkill < 0 ? 0 : overkill); // Overkill
6866 data << uint8(count); // Sub damage count
6867
6868 for (uint32 i = 0; i < count; ++i)
6869 {
6870 data << uint32(damageInfo->damages[i].damageSchoolMask); // School of sub damage
6871 data << float(tmpDamage[i]); // sub damage
6872 data << uint32(tmpDamage[i]); // Sub Damage
6873 }
6874
6876 {
6877 for (uint32 i = 0; i < count; ++i)
6878 {
6879 data << uint32(tmpAbsorb[i]); // Absorb
6880 }
6881 }
6882
6884 {
6885 for (uint32 i = 0; i < count; ++i)
6886 {
6887 data << uint32(damageInfo->damages[i].resist); // Resist
6888 }
6889 }
6890
6891 data << uint8(damageInfo->TargetState);
6892 data << uint32(0); // Unknown attackerstate
6893 data << uint32(0); // Melee spellid
6894
6895 if (damageInfo->HitInfo & HITINFO_BLOCK)
6896 data << uint32(damageInfo->blocked_amount);
6897
6898 if (damageInfo->HitInfo & HITINFO_RAGE_GAIN)
6899 data << uint32(0);
6900
6902 if (damageInfo->HitInfo & HITINFO_UNK1)
6903 {
6904 data << uint32(0);
6905 data << float(0);
6906 data << float(0);
6907 data << float(0);
6908 data << float(0);
6909 data << float(0);
6910 data << float(0);
6911 data << float(0);
6912 data << float(0);
6913 data << float(0); // Found in a loop with 1 iteration
6914 data << float(0); // ditto ^
6915 data << uint32(0);
6916 }
6917
6918 SendMessageToSet(&data, true);
6919}
@ HITINFO_RAGE_GAIN
Definition Unit.h:122
@ HITINFO_UNK1
Definition Unit.h:99
@ SMSG_ATTACKERSTATEUPDATE
Definition Opcodes.h:360

References CalcDamageInfo::absorb, CalcDamageInfo::attacker, CalcDamageInfo::blocked_amount, CHEAT_GOD, CalcDamageInfo::damage, CalcDamageInfo::damages, CalcDamageInfo::damageSchoolMask, Player::GetCommandStatus(), GetHealth(), Object::GetPackGUID(), CalcDamageInfo::HitInfo, HITINFO_BLOCK, HITINFO_FULL_ABSORB, HITINFO_FULL_RESIST, HITINFO_PARTIAL_ABSORB, HITINFO_PARTIAL_RESIST, HITINFO_RAGE_GAIN, HITINFO_UNK1, Object::IsPlayer(), LOG_DEBUG, MAX_ITEM_PROTO_DAMAGES, CalcDamageInfo::resist, WorldObject::SendMessageToSet(), SMSG_ATTACKERSTATEUPDATE, CalcDamageInfo::target, CalcDamageInfo::TargetState, and Object::ToPlayer().

Referenced by AttackerStateUpdate(), misc_commandscript::HandleDamageCommand(), spell_dk_dancing_rune_weapon::HandleProc(), and SendAttackStateUpdate().

◆ SendAttackStateUpdate() [2/2]

void Unit::SendAttackStateUpdate ( uint32  HitInfo,
Unit target,
uint8  SwingType,
SpellSchoolMask  damageSchoolMask,
uint32  Damage,
uint32  AbsorbDamage,
uint32  Resist,
VictimState  TargetState,
uint32  BlockedAmount 
)
6922{
6923 CalcDamageInfo dmgInfo;
6924 dmgInfo.HitInfo = HitInfo;
6925 dmgInfo.attacker = this;
6926 dmgInfo.target = target;
6927
6928 dmgInfo.damages[0].damage = Damage - AbsorbDamage - Resist - BlockedAmount;
6929 dmgInfo.damages[0].damageSchoolMask = damageSchoolMask;
6930 dmgInfo.damages[0].absorb = AbsorbDamage;
6931 dmgInfo.damages[0].resist = Resist;
6932
6933 dmgInfo.damages[1].damage = 0;
6934 dmgInfo.damages[1].damageSchoolMask = 0;
6935 dmgInfo.damages[1].absorb = 0;
6936 dmgInfo.damages[1].resist = 0;
6937
6938 dmgInfo.TargetState = TargetState;
6939 dmgInfo.blocked_amount = BlockedAmount;
6940 SendAttackStateUpdate(&dmgInfo);
6941}
HitInfo
Definition Unit.h:97

References CalcDamageInfo::absorb, CalcDamageInfo::attacker, CalcDamageInfo::blocked_amount, CalcDamageInfo::damage, CalcDamageInfo::damages, CalcDamageInfo::damageSchoolMask, CalcDamageInfo::HitInfo, CalcDamageInfo::resist, SendAttackStateUpdate(), CalcDamageInfo::target, and CalcDamageInfo::TargetState.

◆ SendChangeCurrentVictimOpcode()

void Unit::SendChangeCurrentVictimOpcode ( HostileReference pHostileReference)
16193{
16194 if (!GetThreatMgr().isThreatListEmpty())
16195 {
16196 uint32 count = GetThreatMgr().GetThreatList().size();
16197
16198 LOG_DEBUG("entities.unit", "WORLD: Send SMSG_HIGHEST_THREAT_UPDATE Message");
16199 WorldPacket data(SMSG_HIGHEST_THREAT_UPDATE, 8 + 8 + count * 8);
16200 data << GetPackGUID();
16201 data << pHostileReference->getUnitGuid().WriteAsPacked();
16202 data << uint32(count);
16204 for (ThreatContainer::StorageType::const_iterator itr = tlist.begin(); itr != tlist.end(); ++itr)
16205 {
16206 data << (*itr)->getUnitGuid().WriteAsPacked();
16207 data << uint32((*itr)->GetThreat() * 100);
16208 }
16209 SendMessageToSet(&data, false);
16210 }
16211}
PackedGuid WriteAsPacked() const
Definition ObjectGuid.h:316
std::list< HostileReference * > StorageType
Definition ThreatMgr.h:147
@ SMSG_HIGHEST_THREAT_UPDATE
Definition Opcodes.h:1184

References Object::GetPackGUID(), ThreatMgr::GetThreatList(), GetThreatMgr(), HostileReference::getUnitGuid(), LOG_DEBUG, WorldObject::SendMessageToSet(), SMSG_HIGHEST_THREAT_UPDATE, and ObjectGuid::WriteAsPacked().

Referenced by ThreatMgr::setCurrentVictim().

◆ SendClearTarget()

void Unit::SendClearTarget ( )
16421{
16423 data << GetPackGUID();
16424 SendMessageToSet(&data, false);
16425}
@ SMSG_BREAK_TARGET
Definition Opcodes.h:368

References Object::GetPackGUID(), WorldObject::SendMessageToSet(), and SMSG_BREAK_TARGET.

Referenced by Vehicle::AddPassenger(), and Spell::EffectForceDeselect().

◆ SendClearThreatListOpcode()

void Unit::SendClearThreatListOpcode ( )
16214{
16215 LOG_DEBUG("entities.unit", "WORLD: Send SMSG_THREAT_CLEAR Message");
16217 data << GetPackGUID();
16218 SendMessageToSet(&data, false);
16219}
@ SMSG_THREAT_CLEAR
Definition Opcodes.h:1187

References Object::GetPackGUID(), LOG_DEBUG, WorldObject::SendMessageToSet(), and SMSG_THREAT_CLEAR.

Referenced by ThreatMgr::ClearAllThreat().

◆ SendComboPoints()

void Unit::SendComboPoints ( )
13384{
13385 if (m_cleanupDone)
13386 {
13387 return;
13388 }
13389
13391 if (Player* playerMe = ToPlayer())
13392 {
13393 WorldPacket data(SMSG_UPDATE_COMBO_POINTS, packGUID.size() + 1);
13394 data << packGUID;
13395 data << uint8(m_comboPoints);
13396 playerMe->SendDirectMessage(&data);
13397 }
13398
13399 ObjectGuid ownerGuid = GetCharmerOrOwnerGUID();
13400 Player* owner = nullptr;
13401 if (ownerGuid.IsPlayer())
13402 {
13403 owner = ObjectAccessor::GetPlayer(*this, ownerGuid);
13404 }
13405
13406 if (m_movedByPlayer || owner)
13407 {
13408 WorldPacket data(SMSG_PET_UPDATE_COMBO_POINTS, GetPackGUID().size() + packGUID.size() + 1);
13409 data << GetPackGUID();
13410 data << packGUID;
13411 data << uint8(m_comboPoints);
13412
13413 if (m_movedByPlayer)
13415
13416 if (owner && owner != m_movedByPlayer)
13417 owner->SendDirectMessage(&data);
13418 }
13419}
Definition ObjectGuid.h:263
std::size_t size() const
Definition ObjectGuid.h:274
@ SMSG_PET_UPDATE_COMBO_POINTS
Definition Opcodes.h:1200
@ SMSG_UPDATE_COMBO_POINTS
Definition Opcodes.h:955

References GetCharmerOrOwnerGUID(), Object::GetPackGUID(), ObjectAccessor::GetPlayer(), ObjectGuid::IsPlayer(), m_cleanupDone, m_comboPoints, m_comboTarget, m_movedByPlayer, Player::SendDirectMessage(), PackedGuid::size(), SMSG_PET_UPDATE_COMBO_POINTS, SMSG_UPDATE_COMBO_POINTS, and Object::ToPlayer().

Referenced by AddComboPoints(), and ClearComboPoints().

◆ SendEnergizeSpellLog()

void Unit::SendEnergizeSpellLog ( Unit victim,
uint32  SpellID,
uint32  Damage,
Powers  powertype 
)
8253{
8254 WorldPacket data(SMSG_SPELLENERGIZELOG, (8 + 8 + 4 + 4 + 4 + 1));
8255 data << victim->GetPackGUID();
8256 data << GetPackGUID();
8257 data << uint32(spellID);
8258 data << uint32(powerType);
8259 data << uint32(damage);
8260 SendMessageToSet(&data, true);
8261}
@ SMSG_SPELLENERGIZELOG
Definition Opcodes.h:367

References Object::GetPackGUID(), WorldObject::SendMessageToSet(), and SMSG_SPELLENERGIZELOG.

Referenced by EnergizeBySpell(), and AuraEffect::HandlePeriodicTriggerSpellAuraTick().

◆ SendHealSpellLog()

void Unit::SendHealSpellLog ( HealInfo const &  healInfo,
bool  critical = false 
)
8220{
8221 uint32 overheal = healInfo.GetHeal() - healInfo.GetEffectiveHeal();
8222
8223 // we guess size
8224 WorldPacket data(SMSG_SPELLHEALLOG, (8 + 8 + 4 + 4 + 4 + 4 + 1 + 1));
8225 data << healInfo.GetTarget()->GetPackGUID();
8226 data << GetPackGUID();
8227 data << uint32(healInfo.GetSpellInfo()->Id);
8228 data << uint32(healInfo.GetHeal());
8229 data << uint32(overheal);
8230 data << uint32(healInfo.GetAbsorb()); // Absorb amount
8231 data << uint8(critical ? 1 : 0);
8232 data << uint8(0); // unused
8233 SendMessageToSet(&data, true);
8234}
@ SMSG_SPELLHEALLOG
Definition Opcodes.h:366

References HealInfo::GetAbsorb(), HealInfo::GetEffectiveHeal(), HealInfo::GetHeal(), Object::GetPackGUID(), HealInfo::GetSpellInfo(), HealInfo::GetTarget(), SpellInfo::Id, WorldObject::SendMessageToSet(), and SMSG_SPELLHEALLOG.

Referenced by HealBySpell().

◆ SendMeleeAttackStart()

void Unit::SendMeleeAttackStart ( Unit victim,
Player sendTo = nullptr 
)
3192{
3193 WorldPacket data(SMSG_ATTACKSTART, 8 + 8);
3194 data << GetGUID();
3195 data << victim->GetGUID();
3196 if (sendTo)
3197 sendTo->SendDirectMessage(&data);
3198 else
3199 SendMessageToSet(&data, true);
3200 LOG_DEBUG("entities.unit", "WORLD: Sent SMSG_ATTACKSTART");
3201}
@ SMSG_ATTACKSTART
Definition Opcodes.h:353

References Object::GetGUID(), Object::GetGUID(), LOG_DEBUG, Player::SendDirectMessage(), WorldObject::SendMessageToSet(), and SMSG_ATTACKSTART.

Referenced by Attack(), Player::GetInitialVisiblePackets(), and boss_leotheras_the_blind::Reset().

◆ SendMeleeAttackStop()

void Unit::SendMeleeAttackStop ( Unit victim = nullptr)

Send to the client SMSG_ATTACKSTOP but doesn't clear UNIT_STATE_MELEE_ATTACKING on server side or interrupt spells. Unless you know exactly what you're doing, use AttackStop() or RemoveAllAttackers() instead.

3208{
3209 // pussywizard: calling SendMeleeAttackStop without clearing UNIT_STATE_MELEE_ATTACKING and then AttackStart the same player may spoil npc rotating!
3210 // pussywizard: this happens in some boss scripts, just add clearing here
3211 // ClearUnitState(UNIT_STATE_MELEE_ATTACKING); // commented out for now
3212
3213 WorldPacket data(SMSG_ATTACKSTOP, (8 + 8 + 4));
3214 data << GetPackGUID();
3215
3216 if (victim)
3217 {
3218 data << victim->GetPackGUID();
3219 data << (uint32)victim->isDead();
3220 }
3221 SendMessageToSet(&data, true);
3222 LOG_DEBUG("entities.unit", "WORLD: Sent SMSG_ATTACKSTOP");
3223
3224 if (victim)
3225 LOG_DEBUG("entities.unit", "{} {} stopped attacking {} {}", (IsPlayer() ? "Player" : "Creature"), GetGUID().ToString(), (victim->IsPlayer() ? "player" : "creature"), victim->GetGUID().ToString());
3226 else
3227 LOG_DEBUG("entities.unit", "{} {} stopped attacking", (IsPlayer() ? "Player" : "Creature"), GetGUID().ToString());
3228}
bool isDead() const
Definition Unit.h:1779
@ SMSG_ATTACKSTOP
Definition Opcodes.h:354

References Object::GetGUID(), Object::GetGUID(), Object::GetPackGUID(), isDead(), Object::IsPlayer(), LOG_DEBUG, WorldObject::SendMessageToSet(), SMSG_ATTACKSTOP, and ObjectGuid::ToString().

Referenced by Attack(), AttackStop(), boss_garfrost::boss_garfrostAI::DamageTaken(), npc_ulduar_vx001::DamageTaken(), boss_blood_queen_lana_thel::boss_blood_queen_lana_thelAI::GoToMinchar(), spell_svalna_revive_champion::Land(), boss_leotheras_the_blind::Reset(), SetControlled(), boss_razorscale::SpellHit(), boss_mr_smite::boss_mr_smiteAI::UpdateAI(), boss_onyxia::UpdateAI(), boss_krick::boss_krickAI::UpdateAI(), boss_blood_queen_lana_thel::boss_blood_queen_lana_thelAI::UpdateAI(), boss_sindragosa::boss_sindragosaAI::UpdateAI(), npc_rimefang::npc_rimefangAI::UpdateAI(), boss_sapphiron::boss_sapphironAI::UpdateAI(), boss_malygos::UpdateAI(), boss_mimiron::UpdateAI(), and boss_razorscale::UpdateAI().

◆ SendMonsterMove()

void Unit::SendMonsterMove ( float  NewPosX,
float  NewPosY,
float  NewPosZ,
uint32  TransitTime,
SplineFlags  sf = SPLINEFLAG_WALK_MODE 
)
647{
648 WorldPacket data(SMSG_MONSTER_MOVE, 1 + 12 + 4 + 1 + 4 + 4 + 4 + 12 + GetPackGUID().size());
649 data << GetPackGUID();
650
651 data << uint8(0); // new in 3.1
652 data << GetPositionX() << GetPositionY() << GetPositionZ();
653 data << GameTime::GetGameTimeMS().count();
654 data << uint8(0);
655 data << uint32(sf);
656 data << TransitTime; // Time in between points
657 data << uint32(1); // 1 single waypoint
658 data << NewPosX << NewPosY << NewPosZ; // the single waypoint Point B
659
660 SendMessageToSet(&data, true);
661}
@ SMSG_MONSTER_MOVE
Definition Opcodes.h:251

References GameTime::GetGameTimeMS(), Object::GetPackGUID(), Position::GetPositionX(), Position::GetPositionY(), Position::GetPositionZ(), WorldObject::SendMessageToSet(), and SMSG_MONSTER_MOVE.

Referenced by npc_ulduar_magnetic_core::npc_ulduar_magnetic_core().

◆ SendMovementFeatherFall()

void Unit::SendMovementFeatherFall ( Player sendTo)
16901{
16902 if (!movespline->Initialized())
16903 return;
16905 data << GetPackGUID();
16906 sendTo->SendDirectMessage(&data);
16907}
@ SMSG_SPLINE_MOVE_FEATHER_FALL
Definition Opcodes.h:803

References Object::GetPackGUID(), Movement::MoveSpline::Initialized(), movespline, Player::SendDirectMessage(), and SMSG_SPLINE_MOVE_FEATHER_FALL.

◆ SendMovementFlagUpdate()

void Unit::SendMovementFlagUpdate ( bool  self = false)
13191{
13192 if (IsRooted())
13193 {
13194 // each case where this occurs has to be examined and reported and dealt with.
13195 LOG_ERROR("Unit", "Attempted sending heartbeat with root flag for guid {}", GetGUID().ToString());
13196 return;
13197 }
13198
13199 WorldPacket data;
13200 BuildHeartBeatMsg(&data);
13201 SendMessageToSet(&data, self);
13202}
bool IsRooted() const
Definition Unit.h:1699
void BuildHeartBeatMsg(WorldPacket *data) const
Definition Object.cpp:2076

References BuildHeartBeatMsg(), Object::GetGUID(), IsRooted(), LOG_ERROR, WorldObject::SendMessageToSet(), and Position::ToString().

Referenced by boss_kirtonos_the_herald::boss_kirtonos_the_heraldAI::DoAction(), npc_ball_of_flame::npc_ball_of_flameAI::DoAction(), brann_bronzebeard::brann_bronzebeardAI::DoAction(), npc_madrigosa::DoAction(), boss_nightbane::EnterEvadeMode(), boss_kaelthas::ExecuteMiddleEvent(), boss_blood_queen_lana_thel::boss_blood_queen_lana_thelAI::GoToMinchar(), debug_commandscript::HandleDebugMoveflagsCommand(), boss_felmyst::InitializeAI(), npc_strangulate_vehicle::npc_strangulate_vehicleAI::IsSummonedBy(), boss_harbinger_skyriss::JustSummoned(), MotionMaster::MoveFall(), npc_twilight_volunteer::MovementInform(), boss_volkhan::MovementInform(), boss_felmyst::MovementInform(), npc_eoe_wyrmrest_skytalon::PassengerBoarded(), boss_sister_svalna::boss_sister_svalnaAI::Reset(), npc_dancing_flames::npc_dancing_flamesAI::Reset(), boss_felmyst::ScheduleGroundAbilities(), SetCharm(), boss_devourer_of_souls::boss_devourer_of_soulsAI::SpellHitTarget(), boss_felmyst::StartIntro(), boss_nightbane::TriggerHealthTakeOff(), boss_kirtonos_the_herald::boss_kirtonos_the_heraldAI::UpdateAI(), boss_onyxia::UpdateAI(), boss_anub_arak::UpdateAI(), boss_krick::boss_krickAI::UpdateAI(), boss_blood_queen_lana_thel::boss_blood_queen_lana_thelAI::UpdateAI(), boss_sindragosa::boss_sindragosaAI::UpdateAI(), npc_valkyr_shadowguard::npc_valkyr_shadowguardAI::UpdateAI(), boss_ignis::UpdateAI(), boss_ingvar_the_plunderer::UpdateAI(), boss_koralon::boss_koralonAI::UpdateAI(), and brann_bronzebeard::brann_bronzebeardAI::UpdateEscortAI().

◆ SendMovementHover()

void Unit::SendMovementHover ( Player sendTo)
16910{
16911 if (!movespline->Initialized())
16912 return;
16914 data << GetPackGUID();
16915 sendTo->SendDirectMessage(&data);
16916}
@ SMSG_SPLINE_MOVE_SET_HOVER
Definition Opcodes.h:805

References Object::GetPackGUID(), Movement::MoveSpline::Initialized(), movespline, Player::SendDirectMessage(), and SMSG_SPLINE_MOVE_SET_HOVER.

◆ SendMovementWaterWalking()

void Unit::SendMovementWaterWalking ( Player sendTo)
16892{
16893 if (!movespline->Initialized())
16894 return;
16896 data << GetPackGUID();
16897 sendTo->SendDirectMessage(&data);
16898}
@ SMSG_SPLINE_MOVE_WATER_WALK
Definition Opcodes.h:807

References Object::GetPackGUID(), Movement::MoveSpline::Initialized(), movespline, Player::SendDirectMessage(), and SMSG_SPLINE_MOVE_WATER_WALK.

◆ SendMoveRoot()

void Unit::SendMoveRoot ( bool  state)
protected
14598{
14599 const Player* client = GetClientControlling();
14600
14601 // Apply flags in-place when unit currently is not controlled by a player
14602 if (!client)
14603 {
14604 if (apply)
14605 {
14608 if (!client)
14609 StopMoving();
14610 }
14611 else
14613 }
14614
14615 if (!IsInWorld())
14616 return;
14617
14618 const PackedGuid& guid = GetPackGUID();
14619 // Wrath+ spline root: when unit is currently not controlled by a player
14620 if (!client)
14621 {
14622 WorldPacket data(apply ? SMSG_SPLINE_MOVE_ROOT : SMSG_SPLINE_MOVE_UNROOT, guid.size());
14623 data << guid;
14624 SendMessageToSet(&data, true);
14625 }
14626 // Wrath+ force root: when unit is controlled by a player
14627 else
14628 {
14629 uint32 const counter = client->GetSession()->GetOrderCounter();
14630
14631 WorldPacket data(apply ? SMSG_FORCE_MOVE_ROOT : SMSG_FORCE_MOVE_UNROOT, guid.size() + 4);
14632 data << guid;
14633 data << counter;
14634 client->GetSession()->SendPacket(&data);
14635 client->GetSession()->IncrementOrderCounter();
14636 }
14637}
@ MOVEMENTFLAG_MASK_MOVING_FLY
Definition UnitDefines.h:410
Player const * GetClientControlling() const
Definition Unit.cpp:17585
void SendPacket(WorldPacket const *packet)
Send a packet to the client.
Definition WorldSession.cpp:283
@ SMSG_FORCE_MOVE_UNROOT
Definition Opcodes.h:264
@ SMSG_FORCE_MOVE_ROOT
Definition Opcodes.h:262
@ SMSG_SPLINE_MOVE_UNROOT
Definition Opcodes.h:802
@ SMSG_SPLINE_MOVE_ROOT
Definition Opcodes.h:824
void AddMovementFlag(uint32 flag)
Definition Object.h:343

References MovementInfo::AddMovementFlag(), GetClientControlling(), WorldSession::GetOrderCounter(), Object::GetPackGUID(), Player::GetSession(), WorldSession::IncrementOrderCounter(), Object::IsInWorld(), WorldObject::m_movementInfo, MOVEMENTFLAG_MASK_MOVING_FLY, MOVEMENTFLAG_ROOT, MovementInfo::RemoveMovementFlag(), WorldObject::SendMessageToSet(), WorldSession::SendPacket(), PackedGuid::size(), SMSG_FORCE_MOVE_ROOT, SMSG_FORCE_MOVE_UNROOT, SMSG_SPLINE_MOVE_ROOT, SMSG_SPLINE_MOVE_UNROOT, and StopMoving().

Referenced by Player::BuildPlayerRepop(), Player::KillPlayer(), Player::ResurrectPlayer(), and SetRooted().

◆ SendPeriodicAuraLog()

void Unit::SendPeriodicAuraLog ( SpellPeriodicAuraLogInfo pInfo)
6745{
6746 AuraEffect const* aura = pInfo->auraEff;
6748 data << GetPackGUID();
6749 data << aura->GetCasterGUID().WriteAsPacked();
6750 data << uint32(aura->GetId()); // spellId
6751 data << uint32(1); // count
6752 data << uint32(aura->GetAuraType()); // auraId
6753 switch (aura->GetAuraType())
6754 {
6757 {
6758 //IF we are in cheat mode we swap absorb with damage and set damage to 0, this way we can still debug damage but our hp bar will not drop
6759 uint32 damage = pInfo->damage;
6760 uint32 absorb = pInfo->absorb;
6761 if (IsPlayer() && ToPlayer()->GetCommandStatus(CHEAT_GOD))
6762 {
6763 absorb = damage;
6764 damage = 0;
6765 }
6766
6767 data << uint32(damage); // damage
6768 data << uint32(pInfo->overDamage); // overkill?
6769 data << uint32(aura->GetSpellInfo()->GetSchoolMask());
6770 data << uint32(absorb); // absorb
6771 data << uint32(pInfo->resist); // resist
6772 data << uint8(pInfo->critical); // new 3.1.2 critical tick
6773 }
6774 break;
6777 data << uint32(pInfo->damage); // damage
6778 data << uint32(pInfo->overDamage); // overheal
6779 data << uint32(pInfo->absorb); // absorb
6780 data << uint8(pInfo->critical); // new 3.1.2 critical tick
6781 break;
6784 data << uint32(aura->GetMiscValue()); // power type
6785 data << uint32(pInfo->damage); // damage
6786 break;
6788 data << uint32(aura->GetMiscValue()); // power type
6789 data << uint32(pInfo->damage); // amount
6790 data << float(pInfo->multiplier); // gain multiplier
6791 break;
6792 default:
6793 LOG_ERROR("entities.unit", "Unit::SendPeriodicAuraLog: unknown aura {}", uint32(aura->GetAuraType()));
6794 return;
6795 }
6796
6797 SendMessageToSet(&data, true);
6798}
@ SPELL_AURA_OBS_MOD_HEALTH
Definition SpellAuraDefines.h:83
@ SPELL_AURA_PERIODIC_MANA_LEECH
Definition SpellAuraDefines.h:127
@ SPELL_AURA_OBS_MOD_POWER
Definition SpellAuraDefines.h:84
@ SPELL_AURA_PERIODIC_ENERGIZE
Definition SpellAuraDefines.h:87
@ SMSG_PERIODICAURALOG
Definition Opcodes.h:620
float multiplier
Definition Unit.h:534
bool critical
Definition Unit.h:535
uint32 overDamage
Definition Unit.h:531
uint32 resist
Definition Unit.h:533
uint32 damage
Definition Unit.h:530
AuraEffect const * auraEff
Definition Unit.h:529
uint32 absorb
Definition Unit.h:532

References SpellPeriodicAuraLogInfo::absorb, SpellPeriodicAuraLogInfo::auraEff, CHEAT_GOD, SpellPeriodicAuraLogInfo::critical, SpellPeriodicAuraLogInfo::damage, AuraEffect::GetAuraType(), AuraEffect::GetCasterGUID(), AuraEffect::GetId(), AuraEffect::GetMiscValue(), Object::GetPackGUID(), SpellInfo::GetSchoolMask(), AuraEffect::GetSpellInfo(), Object::IsPlayer(), LOG_ERROR, SpellPeriodicAuraLogInfo::multiplier, SpellPeriodicAuraLogInfo::overDamage, SpellPeriodicAuraLogInfo::resist, WorldObject::SendMessageToSet(), SMSG_PERIODICAURALOG, SPELL_AURA_OBS_MOD_HEALTH, SPELL_AURA_OBS_MOD_POWER, SPELL_AURA_PERIODIC_DAMAGE, SPELL_AURA_PERIODIC_DAMAGE_PERCENT, SPELL_AURA_PERIODIC_ENERGIZE, SPELL_AURA_PERIODIC_HEAL, SPELL_AURA_PERIODIC_MANA_LEECH, Object::ToPlayer(), and ObjectGuid::WriteAsPacked().

Referenced by AuraEffect::HandleObsModPowerAuraTick(), AuraEffect::HandlePeriodicDamageAurasTick(), AuraEffect::HandlePeriodicEnergizeAuraTick(), AuraEffect::HandlePeriodicHealAurasTick(), and AuraEffect::HandlePeriodicManaLeechAuraTick().

◆ SendPetActionFeedback()

void Unit::SendPetActionFeedback ( uint8  msg) const

-------—Pet responses methods--------------—

13096{
13097 Unit* owner = GetOwner();
13098 if (!owner || !owner->IsPlayer())
13099 return;
13100
13102 data << uint8(msg);
13103 owner->ToPlayer()->SendDirectMessage(&data);
13104}
@ SMSG_PET_ACTION_FEEDBACK
Definition Opcodes.h:740

References GetOwner(), Object::IsPlayer(), Player::SendDirectMessage(), SMSG_PET_ACTION_FEEDBACK, and Object::ToPlayer().

Referenced by WorldSession::HandlePetCancelAuraOpcode().

◆ SendPetActionSound()

void Unit::SendPetActionSound ( PetAction  action) const
13107{
13108 SendMessageToSet(WorldPackets::Pet::PetActionSound(GetGUID(), static_cast<int32>(action)).Write(), false);
13109}
Definition PetPackets.h:100

References Object::GetGUID(), and WorldObject::SendMessageToSet().

Referenced by WorldSession::HandlePetActionHelper().

◆ SendPetAIReaction()

void Unit::SendPetAIReaction ( ObjectGuid  guid) const
13118{
13119 Unit* owner = GetOwner();
13120 if (!owner || !owner->IsPlayer())
13121 return;
13122
13123 WorldPacket data(SMSG_AI_REACTION, 8 + 4);
13124 data << guid;
13125 data << uint32(AI_REACTION_HOSTILE);
13126 owner->ToPlayer()->SendDirectMessage(&data);
13127}
@ SMSG_AI_REACTION
Definition Opcodes.h:346

References AI_REACTION_HOSTILE, GetOwner(), Object::IsPlayer(), Player::SendDirectMessage(), SMSG_AI_REACTION, and Object::ToPlayer().

Referenced by PetAI::DoAttack(), and WorldSession::HandlePetActionHelper().

◆ SendPetDismissSound()

void Unit::SendPetDismissSound ( ) const
13112{
13113 if (CreatureDisplayInfoEntry const* displayInfo = sCreatureDisplayInfoStore.LookupEntry(GetNativeDisplayId()))
13114 SendMessageToSet(WorldPackets::Pet::PetDismissSound(static_cast<int32>(displayInfo->ModelId), GetPosition()).Write(), false);
13115}
Definition PetPackets.h:112
Position GetPosition() const
Definition Position.h:147

References GetNativeDisplayId(), Position::GetPosition(), sCreatureDisplayInfoStore, and WorldObject::SendMessageToSet().

Referenced by WorldSession::HandlePetActionHelper().

◆ SendPlaySpellImpact()

void Unit::SendPlaySpellImpact ( ObjectGuid  guid,
uint32  id 
)
15286{
15288 data << guid; // target
15289 data << uint32(id); // SpellVisualKit.dbc index
15290 SendMessageToSet(&data, true);
15291}
@ SMSG_PLAY_SPELL_IMPACT
Definition Opcodes.h:533

References WorldObject::SendMessageToSet(), and SMSG_PLAY_SPELL_IMPACT.

Referenced by debug_commandscript::HandleDebugVisualCommand().

◆ SendPlaySpellVisual()

void Unit::SendPlaySpellVisual ( uint32  id)

◆ SendRemoveFromThreatListOpcode()

void Unit::SendRemoveFromThreatListOpcode ( HostileReference pHostileReference)
16222{
16223 LOG_DEBUG("entities.unit", "WORLD: Send SMSG_THREAT_REMOVE Message");
16224 WorldPacket data(SMSG_THREAT_REMOVE, 8 + 8);
16225 data << GetPackGUID();
16226 data << pHostileReference->getUnitGuid().WriteAsPacked();
16227 SendMessageToSet(&data, false);
16228}
@ SMSG_THREAT_REMOVE
Definition Opcodes.h:1186

References Object::GetPackGUID(), HostileReference::getUnitGuid(), LOG_DEBUG, WorldObject::SendMessageToSet(), SMSG_THREAT_REMOVE, and ObjectGuid::WriteAsPacked().

Referenced by ThreatMgr::processThreatEvent().

◆ SendSpellDamageImmune()

void Unit::SendSpellDamageImmune ( Unit target,
uint32  spellId 
)
6825{
6826 WorldPacket data(SMSG_SPELLORDAMAGE_IMMUNE, 8 + 8 + 4 + 1);
6827 data << GetGUID();
6828 data << target->GetGUID();
6829 data << uint32(spellId);
6830 data << uint8(0); // bool - log format: 0-default, 1-debug
6831 SendMessageToSet(&data, true);
6832}
@ SMSG_SPELLORDAMAGE_IMMUNE
Definition Opcodes.h:641

References Object::GetGUID(), Object::GetGUID(), WorldObject::SendMessageToSet(), and SMSG_SPELLORDAMAGE_IMMUNE.

Referenced by DealDamageShieldDamage(), Spell::EffectEnergize(), Spell::EffectHealMaxHealth(), and AuraEffect::SendTickImmune().

◆ SendSpellDamageResist()

void Unit::SendSpellDamageResist ( Unit target,
uint32  spellId 
)
6815{
6816 WorldPacket data(SMSG_PROCRESIST, 8 + 8 + 4 + 1);
6817 data << GetGUID();
6818 data << target->GetGUID();
6819 data << uint32(spellId);
6820 data << uint8(0); // bool - log format: 0-default, 1-debug
6821 SendMessageToSet(&data, true);
6822}
@ SMSG_PROCRESIST
Definition Opcodes.h:638

References Object::GetGUID(), Object::GetGUID(), WorldObject::SendMessageToSet(), and SMSG_PROCRESIST.

◆ SendSpellMiss()

void Unit::SendSpellMiss ( Unit target,
uint32  spellID,
SpellMissInfo  missInfo 
)
6801{
6802 WorldPacket data(SMSG_SPELLLOGMISS, (4 + 8 + 1 + 4 + 8 + 1));
6803 data << uint32(spellID);
6804 data << GetGUID();
6805 data << uint8(0); // can be 0 or 1
6806 data << uint32(1); // target count
6807 // for (i = 0; i < target count; ++i)
6808 data << target->GetGUID(); // target GUID
6809 data << uint8(missInfo);
6810 // end loop
6811 SendMessageToSet(&data, true);
6812}
@ SMSG_SPELLLOGMISS
Definition Opcodes.h:617

References Object::GetGUID(), Object::GetGUID(), WorldObject::SendMessageToSet(), and SMSG_SPELLLOGMISS.

Referenced by DealDamageShieldDamage(), and Spell::DoAllEffectOnTarget().

◆ SendSpellNonMeleeDamageLog() [1/2]

void Unit::SendSpellNonMeleeDamageLog ( SpellNonMeleeDamage log)
6644{
6645 WorldPacket data(SMSG_SPELLNONMELEEDAMAGELOG, (16 + 4 + 4 + 4 + 1 + 4 + 4 + 1 + 1 + 4 + 4 + 1)); // we guess size
6646 //IF we are in cheat mode we swap absorb with damage and set damage to 0, this way we can still debug damage but our hp bar will not drop
6647 uint32 damage = log->damage;
6648 uint32 absorb = log->absorb;
6649 if (log->target->IsPlayer() && log->target->ToPlayer()->GetCommandStatus(CHEAT_GOD))
6650 {
6651 absorb = damage;
6652 damage = 0;
6653 }
6654 data << log->target->GetPackGUID();
6655 data << log->attacker->GetPackGUID();
6656 data << uint32(log->spellInfo->Id);
6657 data << uint32(damage); // damage amount
6658 int32 overkill = damage - log->target->GetHealth();
6659 data << uint32(overkill > 0 ? overkill : 0); // overkill
6660 data << uint8 (log->schoolMask); // damage school
6661 data << uint32(absorb); // AbsorbedDamage
6662 data << uint32(log->resist); // resist
6663 data << uint8 (log->physicalLog); // if 1, then client show spell name (example: %s's ranged shot hit %s for %u school or %s suffers %u school damage from %s's spell_name
6664 data << uint8 (log->unused); // unused
6665 data << uint32(log->blocked); // blocked
6666 data << uint32(log->HitInfo);
6668 //if (log->HitInfo & SPELL_HIT_TYPE_CRIT_DEBUG)
6669 //{
6670 // data << float(log->CritRoll);
6671 // data << float(log->CritNeeded);
6672 //}
6673 //if (log->HitInfo & SPELL_HIT_TYPE_HIT_DEBUG)
6674 //{
6675 // data << float(log->HitRoll);
6676 // data << float(log->HitNeeded);
6677 //}
6678 //if (log->HitInfo & SPELL_HIT_TYPE_ATTACK_TABLE_DEBUG)
6679 //{
6680 // data << float(log->MissChance);
6681 // data << float(log->DodgeChance);
6682 // data << float(log->ParryChance);
6683 // data << float(log->BlockChance);
6684 // data << float(log->GlanceChance);
6685 // data << float(log->CrushChance);
6686 //}
6687 SendMessageToSet(&data, true);
6688}
@ SPELL_HIT_TYPE_HIT_DEBUG
Definition SharedDefines.h:1548
@ SPELL_HIT_TYPE_ATTACK_TABLE_DEBUG
Definition SharedDefines.h:1551
@ SPELL_HIT_TYPE_CRIT_DEBUG
Definition SharedDefines.h:1546
@ SMSG_SPELLNONMELEEDAMAGELOG
Definition Opcodes.h:622
bool physicalLog
Definition Unit.h:516
bool unused
Definition Unit.h:517

References SpellNonMeleeDamage::absorb, SpellNonMeleeDamage::attacker, SpellNonMeleeDamage::blocked, CHEAT_GOD, SpellNonMeleeDamage::damage, Player::GetCommandStatus(), GetHealth(), Object::GetPackGUID(), SpellNonMeleeDamage::HitInfo, SpellInfo::Id, Object::IsPlayer(), SpellNonMeleeDamage::physicalLog, SpellNonMeleeDamage::resist, SpellNonMeleeDamage::schoolMask, WorldObject::SendMessageToSet(), SMSG_SPELLNONMELEEDAMAGELOG, SPELL_HIT_TYPE_ATTACK_TABLE_DEBUG, SPELL_HIT_TYPE_CRIT_DEBUG, SPELL_HIT_TYPE_HIT_DEBUG, SpellNonMeleeDamage::spellInfo, SpellNonMeleeDamage::target, Object::ToPlayer(), and SpellNonMeleeDamage::unused.

Referenced by CalcAbsorbResist(), DealDamage(), Spell::DoAllEffectOnTarget(), Spell::EffectEnvironmentalDMG(), spell_sindragosa_s_fury::HandleDummy(), AuraEffect::HandlePeriodicHealthLeechAuraTick(), AuraEffect::HandlePeriodicPowerBurnAuraTick(), AuraEffect::HandleProcTriggerDamageAuraProc(), and SendSpellNonMeleeDamageLog().

◆ SendSpellNonMeleeDamageLog() [2/2]

void Unit::SendSpellNonMeleeDamageLog ( Unit target,
SpellInfo const *  spellInfo,
uint32  Damage,
SpellSchoolMask  damageSchoolMask,
uint32  AbsorbedDamage,
uint32  Resist,
bool  PhysicalDamage,
uint32  Blocked,
bool  CriticalHit = false,
bool  Split = false 
)
6691{
6692 SpellNonMeleeDamage log(this, target, spellInfo, damageSchoolMask);
6693 log.damage = Damage;
6694 log.absorb = AbsorbedDamage;
6695 log.resist = Resist;
6696 log.physicalLog = PhysicalDamage;
6697 log.blocked = Blocked;
6698 log.HitInfo = 0;
6699 if (CriticalHit)
6700 {
6701 log.HitInfo |= SPELL_HIT_TYPE_CRIT;
6702 }
6703 if (Split)
6704 {
6705 log.HitInfo |= SPELL_HIT_TYPE_SPLIT;
6706 }
6708}
@ SPELL_HIT_TYPE_SPLIT
Definition SharedDefines.h:1549
Definition Unit.h:502

References SpellNonMeleeDamage::absorb, SpellNonMeleeDamage::blocked, SpellNonMeleeDamage::damage, SpellNonMeleeDamage::HitInfo, SpellNonMeleeDamage::physicalLog, SpellNonMeleeDamage::resist, SendSpellNonMeleeDamageLog(), SPELL_HIT_TYPE_CRIT, and SPELL_HIT_TYPE_SPLIT.

◆ SendSpellNonMeleeReflectLog()

void Unit::SendSpellNonMeleeReflectLog ( SpellNonMeleeDamage log,
Unit attacker 
)
6612{
6613 // Xinef: function for players only, placed in unit because of cosmetics
6614 if (!IsPlayer())
6615 return;
6616
6617 WorldPacket data(SMSG_SPELLNONMELEEDAMAGELOG, (16 + 4 + 4 + 4 + 1 + 4 + 4 + 1 + 1 + 4 + 4 + 1)); // we guess size
6618 // If we are in cheat mode we swap absorb with damage and set damage to 0, this way we can still debug damage but our HP bar will not drop
6619 uint32 damage = log->damage;
6620 uint32 absorb = log->absorb;
6621 if (log->target->IsPlayer() && log->target->ToPlayer()->GetCommandStatus(CHEAT_GOD))
6622 {
6623 absorb = damage;
6624 damage = 0;
6625 }
6626 data << log->target->GetPackGUID();
6627 data << attacker->GetPackGUID();
6628 data << uint32(log->spellInfo->Id);
6629 data << uint32(damage); // damage amount
6630 int32 overkill = damage - log->target->GetHealth();
6631 data << uint32(overkill > 0 ? overkill : 0); // overkill
6632 data << uint8 (log->schoolMask); // damage school
6633 data << uint32(absorb); // AbsorbedDamage
6634 data << uint32(log->resist); // resist
6635 data << uint8 (log->physicalLog); // if 1, then client show spell name (example: %s's ranged shot hit %s for %u school or %s suffers %u school damage from %s's spell_name
6636 data << uint8 (log->unused); // unused
6637 data << uint32(log->blocked); // blocked
6638 data << uint32(log->HitInfo);
6639 data << uint8 (0); // flag to use extend data
6640 ToPlayer()->SendDirectMessage(&data);
6641}

References SpellNonMeleeDamage::absorb, SpellNonMeleeDamage::blocked, CHEAT_GOD, SpellNonMeleeDamage::damage, Player::GetCommandStatus(), GetHealth(), Object::GetPackGUID(), SpellNonMeleeDamage::HitInfo, SpellInfo::Id, Object::IsPlayer(), SpellNonMeleeDamage::physicalLog, SpellNonMeleeDamage::resist, SpellNonMeleeDamage::schoolMask, Player::SendDirectMessage(), SMSG_SPELLNONMELEEDAMAGELOG, SpellNonMeleeDamage::spellInfo, SpellNonMeleeDamage::target, Object::ToPlayer(), and SpellNonMeleeDamage::unused.

Referenced by Spell::DoAllEffectOnTarget().

◆ SendTameFailure()

void Unit::SendTameFailure ( uint8  result)
16094{
16096 data << uint8(result);
16097 ToPlayer()->SendDirectMessage(&data);
16098}
@ SMSG_PET_TAME_FAILURE
Definition Opcodes.h:401

References Player::SendDirectMessage(), SMSG_PET_TAME_FAILURE, and Object::ToPlayer().

Referenced by spell_hun_tame_beast::CheckCast(), and Spell::CheckCast().

◆ SendTeleportPacket()

void Unit::SendTeleportPacket ( Position pos)
16101{
16103 if (IsCreature())
16104 Relocate(&pos);
16105 if (IsPlayer())
16106 {
16107 ToPlayer()->SetCanTeleport(true);
16108 }
16109 WorldPacket data2(MSG_MOVE_TELEPORT, 38);
16110 data2 << GetPackGUID();
16111 BuildMovementPacket(&data2);
16112 if (IsCreature())
16113 Relocate(&oldPos);
16114 if (IsPlayer())
16115 Relocate(&pos);
16116 SendMessageToSet(&data2, false);
16117}
@ MSG_MOVE_TELEPORT
Definition Opcodes.h:227

References BuildMovementPacket(), Position::GetOrientation(), Object::GetPackGUID(), Position::GetPositionX(), Position::GetPositionY(), Position::GetPositionZ(), Object::IsCreature(), Object::IsPlayer(), MSG_MOVE_TELEPORT, Position::Relocate(), WorldObject::SendMessageToSet(), Player::SetCanTeleport(), and Object::ToPlayer().

Referenced by NearTeleportTo(), and Player::TeleportTo().

◆ SendThreatListUpdate()

void Unit::SendThreatListUpdate ( )
16173{
16174 if (!GetThreatMgr().isThreatListEmpty())
16175 {
16176 uint32 count = GetThreatMgr().GetThreatList().size();
16177
16178 //LOG_DEBUG("entities.unit", "WORLD: Send SMSG_THREAT_UPDATE Message");
16179 WorldPacket data(SMSG_THREAT_UPDATE, 8 + count * 8);
16180 data << GetPackGUID();
16181 data << uint32(count);
16183 for (ThreatContainer::StorageType::const_iterator itr = tlist.begin(); itr != tlist.end(); ++itr)
16184 {
16185 data << (*itr)->getUnitGuid().WriteAsPacked();
16186 data << uint32((*itr)->GetThreat() * 100);
16187 }
16188 SendMessageToSet(&data, false);
16189 }
16190}
@ SMSG_THREAT_UPDATE
Definition Opcodes.h:1185

References Object::GetPackGUID(), ThreatMgr::GetThreatList(), GetThreatMgr(), WorldObject::SendMessageToSet(), and SMSG_THREAT_UPDATE.

Referenced by Update().

◆ SetAI()

void Unit::SetAI ( UnitAI newAI)
inline
688{ i_AI = newAI; }

References i_AI.

◆ SetAnimTier()

◆ SetArmor()

void Unit::SetArmor ( int32  val)
inline

◆ SetAttackTime()

◆ setAttackTimer()

◆ SetAuraStack()

void Unit::SetAuraStack ( uint32  spellId,
Unit target,
uint32  stack 
)
15269{
15270 Aura* aura = target->GetAura(spellId, GetGUID());
15271 if (!aura)
15272 aura = AddAura(spellId, target);
15273 if (aura && stack)
15274 aura->SetStackAmount(stack);
15275}
void SetStackAmount(uint8 num)
Definition SpellAuras.cpp:937

References AddAura(), GetAura(), Object::GetGUID(), and Aura::SetStackAmount().

Referenced by boss_viscidus::DamageTaken(), spell_capacitus_polarity_charge::HandleTargets(), spell_thaddius_pos_neg_charge::HandleTargets(), and BattlefieldWG::OnPlayerJoinWar().

◆ SetBaseWeaponDamage()

void Unit::SetBaseWeaponDamage ( WeaponAttackType  attType,
WeaponDamageRange  damageRange,
float  value,
uint8  damageIndex = 0 
)
inline
1200{ m_weaponDamage[attType][damageRange][damageIndex] = value; }

References m_weaponDamage.

Referenced by Player::_ApplyWeaponDamage(), Guardian::InitStatsForLevel(), and Creature::SelectLevel().

◆ SetCanDualWield()

virtual void Unit::SetCanDualWield ( bool  value)
inlinevirtual

◆ SetCanFly()

void Unit::SetCanFly ( bool  enable)

Add the movement flag: MOVEMENTFLAGCAN_FLY. Generaly only use by players, allowing them to fly by pressing space for example. For creatures, please look for DisableGravity().

Doesn't inform the client.

16727{
16728 bool isClientControlled = IsClientControlled();
16729
16730 if (!isClientControlled)
16731 {
16732 if (enable)
16734 else
16736 }
16737
16738 if (!IsInWorld()) // is sent on add to map
16739 return;
16740
16741 if (isClientControlled)
16742 {
16743 if (Player const* player = GetClientControlling())
16744 {
16745 uint32 const counter = player->GetSession()->GetOrderCounter();
16746 const_cast<Player*>(player)->SetPendingFlightChange(counter);
16747
16749 data << GetPackGUID();
16750 data << counter;
16751 player->SendDirectMessage(&data);
16752 player->GetSession()->IncrementOrderCounter();
16753 return;
16754 }
16755 }
16756
16758 data << GetPackGUID();
16759 SendMessageToSet(&data, true);
16760}
@ MOVEMENTFLAG_CAN_FLY
Definition UnitDefines.h:393
@ SMSG_SPLINE_MOVE_SET_FLYING
Definition Opcodes.h:1088
@ SMSG_MOVE_SET_CAN_FLY
Definition Opcodes.h:865
@ SMSG_SPLINE_MOVE_UNSET_FLYING
Definition Opcodes.h:1089
@ SMSG_MOVE_UNSET_CAN_FLY
Definition Opcodes.h:866

References MovementInfo::AddMovementFlag(), GetClientControlling(), Object::GetPackGUID(), IsClientControlled(), Object::IsInWorld(), WorldObject::m_movementInfo, MOVEMENTFLAG_CAN_FLY, MovementInfo::RemoveMovementFlag(), WorldObject::SendMessageToSet(), PackedGuid::size(), SMSG_MOVE_SET_CAN_FLY, SMSG_MOVE_UNSET_CAN_FLY, SMSG_SPLINE_MOVE_SET_FLYING, and SMSG_SPLINE_MOVE_UNSET_FLYING.

Referenced by boss_twin_valkyrAI::boss_twin_valkyrAI(), boss_kirtonos_the_herald::boss_kirtonos_the_heraldAI::DoAction(), npc_ball_of_flame::npc_ball_of_flameAI::DoAction(), npc_kalecgos_kj::DoAction(), boss_nightbane::EnterEvadeMode(), boss_urom::boss_uromAI::EnterEvadeMode(), npc_pet_dk_ebon_gargoyle::FlyAway(), boss_blood_queen_lana_thel::boss_blood_queen_lana_thelAI::GoToMinchar(), AuraEffect::HandleAuraAllowFlight(), AuraEffect::HandleAuraModIncreaseFlightSpeed(), debug_commandscript::HandleDebugMoveflagsCommand(), gm_commandscript::HandleGMFlyCommand(), WorldSession::HandleMoveKnockBackAck(), boss_felmyst::InitializeAI(), npc_pet_dk_ebon_gargoyle::InitializeAI(), npc_infra_green_bomber_generic::npc_infra_green_bomber_genericAI::IsSummonedBy(), boss_urom::boss_uromAI::JustDied(), boss_ayamiss::JustEngagedWith(), npc_icc_spire_frostwyrm::JustReachedHome(), brann_bronzebeard::brann_bronzebeardAI::JustSummoned(), boss_ingvar_the_plunderer::JustSummoned(), boss_kiljaeden::JustSummoned(), boss_onyxia::MovementInform(), boss_blood_queen_lana_thel::boss_blood_queen_lana_thelAI::MovementInform(), boss_sister_svalna::boss_sister_svalnaAI::MovementInform(), npc_icc_spire_frostwyrm::MovementInform(), boss_nazan::MovementInform(), boss_felmyst::MovementInform(), npc_hallows_end_soh::MovementInform(), npc_pet_dk_ebon_gargoyle::MovementInform(), npc_alexstrasza::npc_alexstrasza(), npc_batrider::npc_batrider(), npc_concentrated_ball::npc_concentrated_ballAI::npc_concentrated_ballAI(), npc_pet_gen_moth::npc_pet_gen_moth(), spell_chapter5_light_of_dawn_aura::OnApply(), spell_chapter5_light_of_dawn_aura::OnRemove(), npc_vehicle_d16_propelled_delivery::npc_vehicle_d16_propelled_deliveryAI::PassengerBoarded(), npc_hover_disk::PassengerBoarded(), boss_nightbane::PathEndReached(), boss_nefarian::PathEndReached(), boss_nefarian::Reset(), boss_nightbane::Reset(), npc_image_of_medivh::npc_image_of_medivhAI::Reset(), npc_valkyr_battle_maiden::npc_valkyr_battle_maidenAI::Reset(), npc_hallows_end_soh::Reset(), boss_onyxia::Reset(), boss_ayamiss::Reset(), boss_blood_queen_lana_thel::boss_blood_queen_lana_thelAI::Reset(), boss_sister_svalna::boss_sister_svalnaAI::Reset(), npc_icc_spire_frostwyrm::Reset(), npc_ulduar_mimiron_rocket::Reset(), boss_nazan::Reset(), boss_felmyst::ScheduleGroundAbilities(), SmartAI::SetFly(), npc_simon_bunny::npc_simon_bunnyAI::SetGUID(), boss_urom::boss_uromAI::SpellHit(), boss_felmyst::StartIntro(), boss_nightbane::TriggerHealthTakeOff(), boss_kirtonos_the_herald::boss_kirtonos_the_heraldAI::UpdateAI(), boss_onyxia::UpdateAI(), npc_frost_sphere::npc_frost_sphereAI::UpdateAI(), boss_krick::boss_krickAI::UpdateAI(), boss_blood_queen_lana_thel::boss_blood_queen_lana_thelAI::UpdateAI(), npc_valkyr_shadowguard::npc_valkyr_shadowguardAI::UpdateAI(), boss_urom::boss_uromAI::UpdateAI(), boss_stormcaller_brundir::UpdateAI(), npc_conversing_with_the_depths_trigger::npc_conversing_with_the_depths_triggerAI::UpdateAI(), npc_pet_gen_wind_rider_cub::UpdateAI(), npc_batrider::UpdateAI(), and Creature::UpdateMovementFlags().

◆ SetCanModifyStats()

◆ SetCantProc()

void Unit::SetCantProc ( bool  apply)
13801{
13802 if (apply)
13803 ++m_procDeep;
13804 else
13805 {
13807 --m_procDeep;
13808 }
13809}

References ASSERT, and m_procDeep.

◆ SetCharm()

void Unit::SetCharm ( Unit target,
bool  apply 
)
Todo:
: maybe we can use this flag to check if controlled by player
7866{
7867 if (apply)
7868 {
7869 if (IsPlayer())
7870 {
7871 if (!AddGuidValue(UNIT_FIELD_CHARM, charm->GetGUID()))
7872 LOG_FATAL("entities.unit", "Player {} is trying to charm unit {}, but it already has a charmed unit {}", GetName(), charm->GetEntry(), GetCharmGUID().ToString());
7873
7874 charm->m_ControlledByPlayer = true;
7876 charm->SetUnitFlag(UNIT_FLAG_PLAYER_CONTROLLED);
7877 }
7878 else
7879 {
7880 charm->m_ControlledByPlayer = false;
7882 charm->RemoveUnitFlag(UNIT_FLAG_PLAYER_CONTROLLED);
7883 }
7884
7885 // PvP, FFAPvP
7886 charm->SetByteValue(UNIT_FIELD_BYTES_2, 1, GetByteValue(UNIT_FIELD_BYTES_2, 1));
7887
7888 if (!charm->AddGuidValue(UNIT_FIELD_CHARMEDBY, GetGUID()))
7889 LOG_FATAL("entities.unit", "Unit {} is being charmed, but it already has a charmer {}", charm->GetEntry(), charm->GetCharmerGUID().ToString());
7890
7891 _isWalkingBeforeCharm = charm->IsWalking();
7893 {
7894 charm->SetWalk(false);
7895 charm->SendMovementFlagUpdate();
7896 }
7897
7898 m_Controlled.insert(charm);
7899 }
7900 else
7901 {
7902 charm->ClearUnitState(UNIT_STATE_CHARMED);
7903
7904 if (IsPlayer())
7905 {
7906 if (!RemoveGuidValue(UNIT_FIELD_CHARM, charm->GetGUID()))
7907 LOG_FATAL("entities.unit", "Player {} is trying to uncharm unit {}, but it has another charmed unit {}", GetName(), charm->GetEntry(), GetCharmGUID().ToString());
7908 }
7909
7910 if (!charm->RemoveGuidValue(UNIT_FIELD_CHARMEDBY, GetGUID()))
7911 LOG_FATAL("entities.unit", "Unit {} is being uncharmed, but it has another charmer {}", charm->GetEntry(), charm->GetCharmerGUID().ToString());
7912
7913 if (charm->IsPlayer())
7914 {
7915 charm->m_ControlledByPlayer = true;
7916 charm->SetUnitFlag(UNIT_FLAG_PLAYER_CONTROLLED);
7917 charm->ToPlayer()->UpdatePvPState();
7918 }
7919 else if (Player* player = charm->GetCharmerOrOwnerPlayerOrPlayerItself())
7920 {
7921 charm->m_ControlledByPlayer = true;
7922 charm->SetUnitFlag(UNIT_FLAG_PLAYER_CONTROLLED);
7923 charm->SetByteValue(UNIT_FIELD_BYTES_2, 1, player->GetByteValue(UNIT_FIELD_BYTES_2, 1));
7924
7925 // Xinef: skip controlled erase if charmed unit is owned by charmer
7926 if (charm->IsInWorld() && !charm->IsDuringRemoveFromWorld() && player->GetGUID() == this->GetGUID() && (charm->IsPet() || charm->HasUnitTypeMask(UNIT_MASK_MINION)))
7927 return;
7928 }
7929 else
7930 {
7931 charm->m_ControlledByPlayer = false;
7932 charm->RemoveUnitFlag(UNIT_FLAG_PLAYER_CONTROLLED);
7933 charm->SetByteValue(UNIT_FIELD_BYTES_2, 1, 0);
7934 }
7935
7936 if (charm->IsWalking() != _isWalkingBeforeCharm)
7937 {
7938 charm->SetWalk(_isWalkingBeforeCharm);
7939 charm->SendMovementFlagUpdate(true); // send packet to self, to update movement state on player.
7940 }
7941
7942 m_Controlled.erase(charm);
7943 }
7944}
@ UNIT_STATE_CHARMED
Definition UnitDefines.h:172
bool AddGuidValue(uint16 index, ObjectGuid value)
Definition Object.cpp:675
bool RemoveGuidValue(uint16 index, ObjectGuid value)
Definition Object.cpp:693

References _isWalkingBeforeCharm, Object::AddGuidValue(), ClearUnitState(), Object::GetByteValue(), GetCharmerGUID(), GetCharmerOrOwnerPlayerOrPlayerItself(), GetCharmGUID(), Object::GetEntry(), Object::GetGUID(), Object::GetGUID(), WorldObject::GetName(), HasUnitFlag(), HasUnitTypeMask(), IsDuringRemoveFromWorld(), Object::IsInWorld(), IsPet(), Object::IsPlayer(), IsWalking(), LOG_FATAL, m_Controlled, m_ControlledByPlayer, Object::RemoveGuidValue(), RemoveUnitFlag(), SendMovementFlagUpdate(), Object::SetByteValue(), SetUnitFlag(), SetWalk(), Object::ToPlayer(), ObjectGuid::ToString(), Position::ToString(), UNIT_FIELD_BYTES_2, UNIT_FIELD_CHARM, UNIT_FIELD_CHARMEDBY, UNIT_FLAG_PLAYER_CONTROLLED, UNIT_MASK_MINION, UNIT_STATE_CHARMED, and Player::UpdatePvPState().

Referenced by RemoveCharmedBy(), SetCharmedBy(), and Player::StopCastingCharm().

◆ SetCharmedBy()

bool Unit::SetCharmedBy ( Unit charmer,
CharmType  type,
AuraApplication const *  aurApp = nullptr 
)
14715{
14716 if (!charmer)
14717 return false;
14718
14719 if (!charmer->IsInWorld() || charmer->IsDuringRemoveFromWorld())
14720 {
14721 return false;
14722 }
14723
14724 // dismount players when charmed
14725 if (IsPlayer() && type != CHARM_TYPE_POSSESS)
14727
14728 if (charmer->IsPlayer())
14730
14731 ASSERT(type != CHARM_TYPE_POSSESS || charmer->IsPlayer());
14732 if (type == CHARM_TYPE_VEHICLE && !IsVehicle()) // pussywizard
14733 throw 1;
14734 ASSERT((type == CHARM_TYPE_VEHICLE) == (GetVehicleKit() && GetVehicleKit()->IsControllableVehicle()));
14735
14736 LOG_DEBUG("entities.unit", "SetCharmedBy: charmer {} ({}), charmed {} ({}), type {}.",
14737 charmer->GetEntry(), charmer->GetGUID().ToString(), GetEntry(), GetGUID().ToString(), uint32(type));
14738
14739 if (this == charmer)
14740 {
14741 LOG_FATAL("entities.unit", "Unit::SetCharmedBy: Unit {} ({}) is trying to charm itself!", GetEntry(), GetGUID().ToString());
14742 return false;
14743 }
14744
14745 //if (HasUnitState(UNIT_STATE_UNATTACKABLE))
14746 // return false;
14747
14748 if (IsPlayer() && ToPlayer()->GetTransport())
14749 {
14750 LOG_FATAL("entities.unit", "Unit::SetCharmedBy: Player on transport is trying to charm {} ({})", GetEntry(), GetGUID().ToString());
14751 return false;
14752 }
14753
14754 // Already charmed
14755 if (GetCharmerGUID())
14756 {
14757 LOG_FATAL("entities.unit", "Unit::SetCharmedBy: {} ({}) has already been charmed but {} ({}) is trying to charm it!",
14758 GetEntry(), GetGUID().ToString(), charmer->GetEntry(), charmer->GetGUID().ToString());
14759 return false;
14760 }
14761
14762 CastStop();
14763 AttackStop();
14764
14765 // Xinef: dont reset threat and combat, put them on offline list, moved down after faction changes
14766 // CombatStop(); /// @todo: CombatStop(true) may cause crash (interrupt spells)
14767 // DeleteThreatList();
14768
14769 Player* playerCharmer = charmer->ToPlayer();
14770
14771 // Charmer stop charming
14772 if (playerCharmer)
14773 {
14774 playerCharmer->StopCastingCharm(aurApp ? aurApp->GetBase() : nullptr);
14775 playerCharmer->StopCastingBindSight(aurApp ? aurApp->GetBase() : nullptr);
14776 }
14777
14778 // Charmed stop charming
14779 if (IsPlayer())
14780 {
14781 ToPlayer()->StopCastingCharm(aurApp ? aurApp->GetBase() : nullptr);
14782 ToPlayer()->StopCastingBindSight(aurApp ? aurApp->GetBase() : nullptr);
14783 }
14784
14785 // StopCastingCharm may remove a possessed pet?
14786 if (!IsInWorld())
14787 {
14788 LOG_FATAL("entities.unit", "Unit::SetCharmedBy: {} ({}) is not in world but {} ({}) is trying to charm it!",
14789 GetEntry(), GetGUID().ToString(), charmer->GetEntry(), charmer->GetGUID().ToString());
14790 return false;
14791 }
14792
14793 // charm is set by aura, and aura effect remove handler was called during apply handler execution
14794 // prevent undefined behaviour
14795 if (aurApp && aurApp->GetRemoveMode())
14796 return false;
14797
14799 SetFaction(charmer->GetFaction());
14800
14801 // Set charmed
14802 charmer->SetCharm(this, true);
14803
14805
14806 if (IsCreature())
14807 {
14808 GetMotionMaster()->Clear(false);
14810 StopMoving();
14811
14812 if (charmer->IsPlayer() && charmer->IsClass(CLASS_WARLOCK, CLASS_CONTEXT_PET_CHARM) && ToCreature()->GetCreatureTemplate()->type == CREATURE_TYPE_DEMON)
14813 {
14814 // Disable CreatureAI/SmartAI and switch to CharmAI when charmed by warlock
14815 Creature* charmed = ToCreature();
14816 charmed->NeedChangeAI = true;
14817 charmed->IsAIEnabled = false;
14818 }
14819 else
14820 {
14821 ToCreature()->AI()->OnCharmed(true);
14822 }
14823
14824 // Xinef: If creature can fly, add normal player flying flag (fixes speed)
14825 if (charmer->IsPlayer() && ToCreature()->CanFly())
14827 }
14828 else
14829 {
14830 Player* player = ToPlayer();
14831 if (player->isAFK())
14832 player->ToggleAFK();
14833
14834 player->SetClientControl(this, false); // verified
14835 }
14836
14837 // charm is set by aura, and aura effect remove handler was called during apply handler execution
14838 // prevent undefined behaviour
14839 if (aurApp && aurApp->GetRemoveMode())
14840 return false;
14841
14842 // Pets already have a properly initialized CharmInfo, don't overwrite it.
14843 // Xinef: I need charmInfo for vehicle
14844 if (/*type != CHARM_TYPE_VEHICLE &&*/ !GetCharmInfo())
14845 {
14846 InitCharmInfo();
14847 if (type == CHARM_TYPE_POSSESS)
14849 else if (type != CHARM_TYPE_VEHICLE)
14850 {
14852
14853 // Xinef: convert charm npcs dont have pet bar so initialize them as defensive helpers
14854 if (type == CHARM_TYPE_CONVERT && IsCreature())
14856 }
14857 }
14858
14859 if (playerCharmer)
14860 {
14861 switch (type)
14862 {
14863 case CHARM_TYPE_VEHICLE:
14866 playerCharmer->SetClientControl(this, true); // verified
14867 playerCharmer->VehicleSpellInitialize();
14868 break;
14869 case CHARM_TYPE_POSSESS:
14874 playerCharmer->SetClientControl(this, true); // verified
14875 playerCharmer->PossessSpellInitialize();
14876 break;
14877 case CHARM_TYPE_CHARM:
14879 {
14881 if (cinfo && cinfo->type == CREATURE_TYPE_DEMON)
14882 {
14883 // to prevent client crash
14885
14886 // just to enable stat window
14887 if (GetCharmInfo())
14888 GetCharmInfo()->SetPetNumber(sObjectMgr->GeneratePetNumber(), true);
14889
14890 // if charmed two demons the same session, the 2nd gets the 1st one's name
14891 SetUInt32Value(UNIT_FIELD_PET_NAME_TIMESTAMP, uint32(GameTime::GetGameTime().count())); // cast can't be helped
14892 }
14893 }
14894 if (playerCharmer->m_seer != this)
14895 {
14897 playerCharmer->CharmSpellInitialize();
14898 }
14899 break;
14900 default:
14901 break;
14902 }
14903 }
14904 else if (IsPlayer())
14906
14908
14909 if (Creature* creature = ToCreature())
14910 creature->RefreshSwimmingFlag();
14911
14912 if (IsPlayer())
14913 sScriptMgr->OnPlayerBeingCharmed(ToPlayer(), charmer, _oldFactionId, charmer->GetFaction());
14914
14915 return true;
14916}
@ CHARM_TYPE_CONVERT
Definition CharmInfo.h:48
@ CLASS_MAGE
Definition SharedDefines.h:148
@ REACT_DEFENSIVE
Definition Unit.h:561
@ UNIT_FIELD_PET_NAME_TIMESTAMP
Definition UpdateFields.h:133
void OnCharmed(bool apply) override
Called when unit is charmed.
Definition CreatureAI.cpp:36
void SetReactState(ReactStates state)
A creature can have 3 ReactStates : Agressive, Passive, Neutral.
Definition Creature.h:99
void MoveIdle()
Definition MotionMaster.cpp:233
void CharmSpellInitialize()
Definition Player.cpp:9674
WorldObject * m_seer
Definition Player.h:2367
void ToggleAFK()
Definition Player.cpp:1311
void PossessSpellInitialize()
Definition Player.cpp:9571
bool isAFK() const
Definition Player.h:1149
void VehicleSpellInitialize()
Definition Player.cpp:9599
void StopCastingBindSight(Aura *except=nullptr)
Definition Player.cpp:13158
void AddUnitMovementFlag(uint32 f)
Definition Unit.h:766
virtual float GetFollowAngle() const
Definition Unit.h:1879
CharmInfo * InitCharmInfo()
Definition Unit.cpp:12807
void InitPossessCreateSpells()
Definition CharmInfo.cpp:77
void InitCharmCreateSpells()
Definition CharmInfo.cpp:98

References _oldFactionId, AddUnitMovementFlag(), AddUnitState(), Creature::AI(), ASSERT, AttackStop(), CanFly(), CastStop(), CHARM_TYPE_CHARM, CHARM_TYPE_CONVERT, CHARM_TYPE_POSSESS, CHARM_TYPE_VEHICLE, Player::CharmSpellInitialize(), CLASS_CONTEXT_PET_CHARM, CLASS_MAGE, CLASS_WARLOCK, MotionMaster::Clear(), CREATURE_TYPE_DEMON, AuraApplication::GetBase(), GetCharmerGUID(), GetCharmInfo(), Creature::GetCreatureTemplate(), Object::GetEntry(), GetFaction(), GetFollowAngle(), GameTime::GetGameTime(), Object::GetGUID(), Object::GetGUID(), GetMotionMaster(), AuraApplication::GetRemoveMode(), WorldObject::GetTransport(), GetVehicleKit(), CharmInfo::InitCharmCreateSpells(), InitCharmInfo(), CharmInfo::InitPossessCreateSpells(), Player::isAFK(), IsAIEnabled, IsClass(), Object::IsCreature(), IsDuringRemoveFromWorld(), Object::IsInWorld(), Object::IsPlayer(), IsVehicle(), LOG_DEBUG, LOG_FATAL, Player::m_seer, MotionMaster::MoveFollow(), MotionMaster::MoveIdle(), MOVEMENTFLAG_FLYING, NeedChangeAI, CreatureAI::OnCharmed(), PET_FOLLOW_DIST, Player::PossessSpellInitialize(), REACT_DEFENSIVE, RemoveAurasByType(), Object::SetByteValue(), SetCharm(), Player::SetClientControl(), SetFaction(), CharmInfo::SetPetNumber(), Creature::SetReactState(), SetUInt32Value(), SetUnitFlag(), sObjectMgr, SPELL_AURA_MOD_SHAPESHIFT, SPELL_AURA_MOUNTED, sScriptMgr, StopAttackingInvalidTarget(), Player::StopCastingBindSight(), Player::StopCastingCharm(), StopMoving(), Object::ToCreature(), Player::ToggleAFK(), Object::ToPlayer(), ObjectGuid::ToString(), Position::ToString(), CreatureTemplate::type, UNIT_FIELD_BYTES_0, UNIT_FIELD_PET_NAME_TIMESTAMP, UNIT_FLAG_DISABLE_MOVE, UNIT_FLAG_POSSESSED, UNIT_STATE_CHARMED, UNIT_STATE_NO_ENVIRONMENT_UPD, UNIT_STATE_POSSESSED, and Player::VehicleSpellInitialize().

Referenced by Vehicle::AddPassenger(), AuraEffect::HandleCharmConvert(), AuraEffect::HandleModCharm(), AuraEffect::HandleModPossess(), AuraEffect::HandleModPossessPet(), and Puppet::InitSummon().

◆ SetCharmerGUID()

void Unit::SetCharmerGUID ( ObjectGuid  owner)
inline

◆ SetCombatTimer()

void Unit::SetCombatTimer ( uint32  timer)
inline
939{ m_CombatTimer = timer; }

References m_CombatTimer.

◆ SetConfused()

void Unit::SetConfused ( bool  apply)
protected
14683{
14684 if (apply)
14685 {
14686 SetTarget();
14688 }
14689 else
14690 {
14691 if (IsAlive())
14692 {
14693 if (GetMotionMaster()->GetMotionSlotType(MOTION_SLOT_CONTROLLED) == CONFUSED_MOTION_TYPE)
14694 {
14696 StopMoving();
14697 }
14698
14699 if (GetVictim())
14701 }
14702 }
14703
14704 // xinef: block / allow control to real mover (eg. charmer)
14705 if (IsPlayer())
14706 {
14707 if (m_movedByPlayer)
14708 m_movedByPlayer->ToPlayer()->SetClientControl(this, !apply); // verified
14709 //else
14710 // ToPlayer()->SetClientControl(this, !apply);
14711 }
14712}
@ CONFUSED_MOTION_TYPE
Definition MotionMaster.h:44
void MoveConfused()
Enable the confusion movement. Doesn't work with UNIT_FLAG_DISABLE_MOVE.
Definition MotionMaster.cpp:293

References CONFUSED_MOTION_TYPE, Object::GetGUID(), GetMotionMaster(), GetVictim(), IsAlive(), Object::IsPlayer(), m_movedByPlayer, MOTION_SLOT_CONTROLLED, MotionMaster::MoveConfused(), MotionMaster::MovementExpired(), Player::SetClientControl(), SetTarget(), StopMoving(), and Object::ToPlayer().

Referenced by SetControlled().

◆ SetContestedPvP()

void Unit::SetContestedPvP ( Player attackedPlayer = nullptr,
bool  lookForNearContestedGuards = true 
)
13763{
13765
13766 if (!player || ((attackedPlayer && (attackedPlayer == player || (player->duel && player->duel->Opponent == attackedPlayer))) || player->InBattleground()))
13767 return;
13768
13769 // check if there any guards that should care about the contested flag on player
13770 if (lookForNearContestedGuards)
13771 {
13772 std::list<Unit*> targets;
13775 Cell::VisitObjects(this, searcher, MAX_AGGRO_RADIUS);
13776
13777 // return if there are no contested guards found
13778 if (!targets.size())
13779 {
13780 return;
13781 }
13782 }
13783
13784 player->SetContestedPvPTimer(30000);
13786 {
13789 // call MoveInLineOfSight for nearby contested guards
13791 }
13793 {
13795 // call MoveInLineOfSight for nearby contested guards
13797 }
13798}
#define MAX_AGGRO_RADIUS
Definition Unit.h:45
void SetPlayerFlag(PlayerFlags flags)
Definition Player.h:1124
bool InBattleground() const
Definition Player.h:2285
void SetContestedPvPTimer(uint32 newTime)
Definition Player.h:1883

References WorldObject::AddToNotify(), AddUnitState(), Player::duel, GetCharmerOrOwnerPlayerOrPlayerItself(), HasUnitState(), Player::InBattleground(), MAX_AGGRO_RADIUS, NOTIFY_AI_RELOCATION, PLAYER_FLAGS_CONTESTED_PVP, Player::SetContestedPvPTimer(), Player::SetPlayerFlag(), UNIT_STATE_ATTACK_PLAYER, and Cell::VisitObjects().

Referenced by CombatStart(), CombatStartOnCast(), Spell::DoSpellHitOnUnit(), and WorldSession::HandlePlayerLoginFromDB().

◆ SetControlled()

void Unit::SetControlled ( bool  apply,
UnitState  state,
Unit source = nullptr,
bool  isFear = false 
)
14410{
14411 if (apply)
14412 {
14413 if (HasUnitState(state))
14414 return;
14415
14416 AddUnitState(state);
14417 switch (state)
14418 {
14419 case UNIT_STATE_STUNNED:
14420 SetStunned(true);
14421 break;
14422 case UNIT_STATE_ROOT:
14424 SetRooted(true);
14425 break;
14428 {
14431 // SendAutoRepeatCancel ?
14432 SetConfused(true);
14433 CastStop(0, false);
14434 }
14435 break;
14436 case UNIT_STATE_FLEEING:
14438 {
14441 // SendAutoRepeatCancel ?
14442 SetFeared(true, source, isFear);
14443 CastStop(0, false);
14444 }
14445 break;
14446 default:
14447 break;
14448 }
14449
14450 if (IsPlayer())
14451 {
14452 sScriptMgr->AnticheatSetRootACKUpd(ToPlayer());
14453 }
14454 }
14455 else
14456 {
14457 // xinef: moved from below, checked all SetX functions, no calls to currently modified state
14458 // xinef: added to each case because of return
14459 //ClearUnitState(state);
14460
14461 switch (state)
14462 {
14463 case UNIT_STATE_STUNNED:
14464 if (HasStunAura())
14465 return;
14466 ClearUnitState(state);
14467 SetStunned(false);
14468 break;
14469 case UNIT_STATE_ROOT:
14470 // Prevent creature_template_movement rooted flag from being removed on aura expiration.
14471 if (IsCreature())
14472 {
14473 if (ToCreature()->GetCreatureTemplate()->Movement.Rooted)
14474 {
14475 return;
14476 }
14477 }
14478
14479 if (HasRootAura() || GetVehicle())
14480 return;
14481 ClearUnitState(state);
14482 SetRooted(false);
14483 break;
14485 if (HasConfuseAura())
14486 return;
14487 ClearUnitState(state);
14488 SetConfused(false);
14489 break;
14490 case UNIT_STATE_FLEEING:
14491 if (HasFearAura())
14492 return;
14493 ClearUnitState(state);
14494 SetFeared(false);
14495 break;
14496 default:
14497 return;
14498 }
14499
14500 //ClearUnitState(state);
14501
14503 SetStunned(true);
14504 else
14505 {
14507 SetRooted(true);
14508
14510 SetConfused(true);
14512 {
14513 bool isFear = false;
14514 if (HasFearAura())
14515 {
14516 isFear = true;
14517 source = ObjectAccessor::GetUnit(*this, GetAuraEffectsByType(SPELL_AURA_MOD_FEAR).front()->GetCasterGUID());
14518 }
14519
14520 if (!source)
14521 {
14522 source = getAttackerForHelper();
14523 }
14524
14525 SetFeared(true, source, isFear);
14526 }
14527 }
14528 }
14529}
void SetFeared(bool apply, Unit *fearedBy=nullptr, bool isFear=false)
Definition Unit.cpp:14650
bool HasStunAura() const
Definition Unit.h:1823
void SetConfused(bool apply)
Definition Unit.cpp:14682
void SetStunned(bool apply)
Definition Unit.cpp:14531
Unit * getAttackerForHelper() const
Definition Unit.cpp:862
bool HasConfuseAura() const
Definition Unit.h:1821
void SetRooted(bool apply, bool stun=false, bool logout=false)
Definition Unit.cpp:14577
bool HasRootAura() const
Definition Unit.h:1822
bool HasFearAura() const
Definition Unit.h:1820
Definition Unit.h:264

References AddUnitState(), CastStop(), ClearUnitState(), getAttackerForHelper(), GetAuraEffectsByType(), ObjectAccessor::GetUnit(), GetVehicle(), HasConfuseAura(), HasFearAura(), HasRootAura(), HasStunAura(), HasUnitState(), Object::IsCreature(), Object::IsPlayer(), SendMeleeAttackStop(), SetConfused(), SetFeared(), SetRooted(), SetStunned(), SPELL_AURA_MOD_FEAR, sScriptMgr, Object::ToCreature(), Object::ToPlayer(), UNIT_STATE_CONFUSED, UNIT_STATE_FLEEING, UNIT_STATE_MELEE_ATTACKING, UNIT_STATE_ROOT, and UNIT_STATE_STUNNED.

Referenced by _ExitVehicle(), Vehicle::AddPassenger(), boss_ahune::boss_ahune(), boss_ouro::boss_ouro(), boss_black_knight::boss_black_knightAI::DamageTaken(), boss_ingvar_the_plunderer::DamageTaken(), npc_vrykul_skeleton::DamageTaken(), npc_blistering_zombie::npc_blistering_zombieAI::DamageTaken(), npc_molten_golem::DamageTaken(), boss_twinemperorsAI::DoAction(), npc_twilight_volunteer::DoAction(), npc_terenas_menethil::npc_terenas_menethilAI::DoAction(), npc_black_knight_skeletal_gryphon::npc_black_knight_skeletal_gryphonAI::DoAction(), boss_thaddius_summon::boss_thaddius_summonAI::DoAction(), boss_yoggsaron::DoAction(), boss_palehoof::boss_palehoofAI::DoAction(), boss_skadi::boss_skadiAI::DoAction(), boss_illidan_stormrage::DoAction(), npc_akama_illidan::DoAction(), Creature::DoFleeToGetAssistance(), boss_skeram::DoTeleport(), CritterAI::EnterEvadeMode(), boss_devourer_of_souls::boss_devourer_of_soulsAI::EnterEvadeMode(), boss_falric::boss_falricAI::EnterEvadeMode(), boss_garfrost::boss_garfrostAI::EnterEvadeMode(), boss_rotface::boss_rotfaceAI::EnterEvadeMode(), boss_noth::boss_nothAI::EnterEvadeMode(), boss_thaddius_summon::boss_thaddius_summonAI::EnterEvadeMode(), boss_urom::boss_uromAI::EnterEvadeMode(), boss_varos::boss_varosAI::EnterEvadeMode(), boss_ignis::EnterEvadeMode(), boss_razorscale::EnterEvadeMode(), boss_ingvar_the_plunderer::EnterEvadeMode(), boss_svala::boss_svalaAI::EnterEvadeMode(), boss_cyanigosa::boss_cyanigosaAI::EnterEvadeMode(), boss_shirrak_the_dead_watcher::EnterEvadeMode(), spell_boss_magus_telestra_summon_telestra_clones_aura::HandleApply(), AuraEffect::HandleAuraModRoot(), AuraEffect::HandleAuraModStun(), debug_commandscript::HandleDebugMoveflagsCommand(), spell_q13007_iron_colossus::HandleDummy(), spell_herald_volzaj_insanity::HandleDummyEffect(), spell_mc_play_dead_aura::HandleEffectApply(), spell_gen_visual_dummy_stun::HandleEffectApply(), spell_q11396_11399_force_shield_arcane_purple_x3::HandleEffectApply(), spell_mc_play_dead_aura::HandleEffectRemove(), spell_gen_visual_dummy_stun::HandleEffectRemove(), AuraEffect::HandleModConfuse(), AuraEffect::HandleModFear(), AuraEffect::HandlePreventFleeing(), spell_boss_magus_telestra_summon_telestra_clones_aura::HandleRemove(), boss_volazj::JustDied(), CritterAI::JustEngagedWith(), boss_shirrak_the_dead_watcher::JustEngagedWith(), boss_skeram::JustSummoned(), npc_twilight_volunteer::MovementInform(), boss_garfrost::boss_garfrostAI::MovementInform(), boss_volkhan::MovementInform(), boss_razorscale::MovementInform(), boss_illidan_stormrage::MovementInform(), npc_gunship_mage::npc_gunship_mageAI::MovementInform(), npc_gunship_gunner::npc_gunship_gunnerAI::MovementInform(), npc_gunship_rocketeer::npc_gunship_rocketeerAI::MovementInform(), npc_ball_of_flame::npc_ball_of_flameAI::MovementInform(), npc_hodirs_fury::MovementInform(), npc_iron_watcher::npc_iron_watcherAI::MovementInform(), npc_buru_egg::npc_buru_egg(), npc_icc_blood_beast::npc_icc_blood_beastAI::npc_icc_blood_beastAI(), npc_overlord_drakuru_betrayal::npc_overlord_drakuru_betrayal(), npc_raging_spirit::npc_raging_spiritAI::npc_raging_spiritAI(), npc_vengeful_shade::npc_vengeful_shadeAI::npc_vengeful_shadeAI(), spell_systems_shutdown_aura::OnApply(), spell_systems_shutdown_aura::OnRemove(), npc_akama_illidan::PathEndReached(), boss_ragnaros::boss_ragnarosAI::Reset(), boss_skeram::Reset(), boss_volazj::Reset(), npc_twilight_summon::Reset(), boss_devourer_of_souls::boss_devourer_of_soulsAI::Reset(), boss_falric::boss_falricAI::Reset(), boss_garfrost::boss_garfrostAI::Reset(), boss_noth::boss_nothAI::Reset(), boss_thaddius::boss_thaddiusAI::Reset(), boss_thaddius_summon::boss_thaddius_summonAI::Reset(), boss_varos::boss_varosAI::Reset(), boss_ignis::Reset(), boss_thorim_pillar::Reset(), boss_xt002::Reset(), boss_yoggsaron_immortal_guardian::Reset(), boss_ingvar_the_plunderer::Reset(), boss_palehoof::boss_palehoofAI::Reset(), npc_tournament_training_dummy::npc_tournament_training_dummyAI::Reset(), npc_iron_watcher::npc_iron_watcherAI::Reset(), boss_shirrak_the_dead_watcher::Reset(), boss_illidan_stormrage::Reset(), npc_akama_illidan::Reset(), npc_target_dummy::npc_target_dummyAI::Reset(), boss_illidan_stormrage::ScheduleAbilities(), Player::SetClientControl(), boss_urom::boss_uromAI::SpellHit(), boss_black_knight::boss_black_knightAI::SpellHitTarget(), npc_vengeful_shade::npc_vengeful_shadeAI::SpellHitTarget(), boss_volkhan::SpellHitTarget(), boss_devourer_of_souls::boss_devourer_of_soulsAI::SpellHitTarget(), boss_ionar::Split(), boss_noth::boss_nothAI::StartBalconyPhase(), boss_noth::boss_nothAI::StartGroundPhase(), boss_skeram::UpdateAI(), boss_volazj::UpdateAI(), boss_falric::boss_falricAI::UpdateAI(), npc_icc_blood_beast::npc_icc_blood_beastAI::UpdateAI(), npc_vengeful_shade::npc_vengeful_shadeAI::UpdateAI(), boss_rotface::boss_rotfaceAI::UpdateAI(), boss_sindragosa::boss_sindragosaAI::UpdateAI(), npc_raging_spirit::npc_raging_spiritAI::UpdateAI(), npc_terenas_menethil::npc_terenas_menethilAI::UpdateAI(), boss_thaddius::boss_thaddiusAI::UpdateAI(), boss_thaddius_summon::boss_thaddius_summonAI::UpdateAI(), boss_urom::boss_uromAI::UpdateAI(), boss_varos::boss_varosAI::UpdateAI(), boss_ionar::UpdateAI(), npc_hodirs_fury::UpdateAI(), boss_ignis::UpdateAI(), boss_razorscale::UpdateAI(), boss_xt002::UpdateAI(), boss_yoggsaron_immortal_guardian::UpdateAI(), boss_ingvar_the_plunderer::UpdateAI(), npc_vrykul_skeleton::UpdateAI(), boss_palehoof::boss_palehoofAI::UpdateAI(), boss_skadi::boss_skadiAI::UpdateAI(), boss_svala::boss_svalaAI::UpdateAI(), boss_cyanigosa::boss_cyanigosaAI::UpdateAI(), npc_tournament_training_dummy::npc_tournament_training_dummyAI::UpdateAI(), npc_target_dummy::npc_target_dummyAI::UpdateAI(), Creature::UpdateEntry(), and npc_black_knight_skeletal_gryphon::npc_black_knight_skeletal_gryphonAI::WaypointReached().

◆ SetCreateHealth()

◆ SetCreateMana()

◆ SetCreateStat()

void Unit::SetCreateStat ( Stats  stat,
float  val 
)
inline

◆ SetCreatorGUID()

◆ SetCritterGUID()

void Unit::SetCritterGUID ( ObjectGuid  guid)
inline

◆ SetCurrentCastedSpell()

void Unit::SetCurrentCastedSpell ( Spell pSpell)
4098{
4099 ASSERT(pSpell); // nullptr may be never passed here, use InterruptSpell or InterruptNonMeleeSpells
4100
4101 CurrentSpellTypes CSpellType = pSpell->GetCurrentContainer();
4102
4103 if (pSpell == m_currentSpells[CSpellType]) // avoid breaking self
4104 return;
4105
4106 bool bySelf = m_currentSpells[CSpellType] && m_currentSpells[CSpellType]->m_spellInfo->Id == pSpell->m_spellInfo->Id;
4107
4108 // break same type spell if it is not delayed
4109 InterruptSpell(CSpellType, false, true, bySelf);
4110
4111 // special breakage effects:
4112 switch (CSpellType)
4113 {
4115 {
4116 // generic spells always break channeled not delayed spells
4118 {
4119 if (!s->GetSpellInfo()->IsActionAllowedChannel())
4120 {
4122 }
4123 }
4124
4125 // autorepeat breaking
4127 {
4128 // break autorepeat if not Auto Shot
4129 if (m_currentSpells[CURRENT_AUTOREPEAT_SPELL]->m_spellInfo->Id != 75)
4131 m_AutoRepeatFirstCast = true;
4132 }
4133
4134 // melee spells breaking
4136 {
4137 // break melee spells if cast time
4138 if (pSpell->GetCastTime() > 0)
4139 {
4141 }
4142 }
4143 if (pSpell->GetCastTime() > 0)
4145
4146 break;
4147 }
4149 {
4150 // channel spells always break generic non-delayed and any channeled spells
4152 InterruptSpell(CURRENT_CHANNELED_SPELL, true, true, bySelf);
4153
4154 // it also does break autorepeat if not Auto Shot
4156 m_currentSpells[CURRENT_AUTOREPEAT_SPELL]->m_spellInfo->Id != 75)
4159
4160 break;
4161 }
4163 {
4164 // only Auto Shoot does not break anything
4165 if (pSpell->m_spellInfo->Id != 75)
4166 {
4167 // generic autorepeats break generic non-delayed and channeled non-delayed spells
4169 {
4170 if (!s->GetSpellInfo()->IsActionAllowedChannel())
4171 {
4173 }
4174 }
4175
4177 }
4178 // special action: set first cast flag
4179 m_AutoRepeatFirstCast = true;
4180
4181 break;
4182 }
4183
4184 default:
4185 // other spell types don't break anything now
4186 break;
4187 }
4188
4189 // current spell (if it is still here) may be safely deleted now
4190 if (m_currentSpells[CSpellType])
4191 m_currentSpells[CSpellType]->SetReferencedFromCurrent(false);
4192
4193 // set new current spell
4194 m_currentSpells[CSpellType] = pSpell;
4195 pSpell->SetReferencedFromCurrent(true);
4196
4197 pSpell->m_selfContainer = &(m_currentSpells[pSpell->GetCurrentContainer()]);
4198}
CurrentSpellTypes GetCurrentContainer() const
Definition Spell.cpp:7895
Spell ** m_selfContainer
Definition Spell.h:623

References AddUnitState(), ASSERT, CURRENT_AUTOREPEAT_SPELL, CURRENT_CHANNELED_SPELL, CURRENT_GENERIC_SPELL, CURRENT_MELEE_SPELL, Spell::GetCastTime(), Spell::GetCurrentContainer(), GetCurrentSpell(), SpellInfo::Id, InterruptSpell(), m_AutoRepeatFirstCast, m_currentSpells, Spell::m_selfContainer, Spell::m_spellInfo, Spell::SetReferencedFromCurrent(), and UNIT_STATE_CASTING.

Referenced by Spell::prepare().

◆ setDeathState()

void Unit::setDeathState ( DeathState  s,
bool  despawn = false 
)
virtual

Reimplemented in Creature, Minion, Pet, and Player.

11434{
11435 // death state needs to be updated before RemoveAllAurasOnDeath() calls HandleChannelDeathItem(..) so that
11436 // it can be used to check creation of death items (such as soul shards).
11437 m_deathState = s;
11438
11440 {
11441 CombatStop();
11444 ClearComboPointHolders(); // any combo points pointed to unit lost at it death
11445
11446 if (IsNonMeleeSpellCast(false))
11448
11449 UnsummonAllTotems(true);
11450 RemoveAllControlled(true);
11452 }
11453
11454 if (s == DeathState::JustDied)
11455 {
11456 // remove aurastates allowing special moves
11459
11460 GetMotionMaster()->Clear(false);
11462
11463 // Xinef: Remove Hover so the corpse can fall to the ground
11464 SetHover(false);
11465
11466 if (despawn)
11467 DisableSpline();
11468 else
11469 StopMoving();
11470
11471 // without this when removing IncreaseMaxHealth aura player may stuck with 1 hp
11472 // do not why since in IncreaseMaxHealth currenthealth is checked
11473 SetHealth(0);
11474 SetPower(getPowerType(), 0);
11475
11476 // Stop emote on death
11478
11479 // players in instance don't have ZoneScript, but they have InstanceScript
11481 zoneScript->OnUnitDeath(this);
11482 }
11483 else if (s == DeathState::JustRespawned)
11484 {
11485 RemoveFlag (UNIT_FIELD_FLAGS, UNIT_FLAG_SKINNABLE); // clear skinnable for creature and player (at battleground)
11486 }
11487}
@ UNIT_FLAG_SKINNABLE
Definition UnitDefines.h:280
void SetHover(bool enable)
Definition Unit.cpp:16803
void ClearAllReactives()
Definition Unit.cpp:13429
void ClearDiminishings()
Definition Unit.h:1846
InstanceScript * GetInstanceScript() const
Definition Object.cpp:1214
ZoneScript * GetZoneScript() const
Definition Object.h:626
Definition ZoneScript.h:26

References Alive, MotionMaster::Clear(), ClearAllReactives(), ThreatMgr::ClearAllThreat(), ClearComboPointHolders(), ClearDiminishings(), CombatStop(), HostileRefMgr::deleteReferences(), DisableSpline(), getHostileRefMgr(), WorldObject::GetInstanceScript(), GetMotionMaster(), getPowerType(), GetThreatMgr(), WorldObject::GetZoneScript(), InterruptNonMeleeSpells(), IsNonMeleeSpellCast(), JustDied, JustRespawned, m_deathState, MotionMaster::MoveIdle(), RemoveAllAurasOnDeath(), RemoveAllControlled(), Object::RemoveFlag(), SetHealth(), SetHover(), SetPower(), SetUInt32Value(), StopMoving(), UNIT_FIELD_FLAGS, UNIT_FLAG_SKINNABLE, UNIT_NPC_EMOTESTATE, and UnsummonAllTotems().

Referenced by _ExitVehicle(), KillMagnetEvent::Execute(), Spell::finish(), WorldSession::HandlePetActionHelper(), AuraEffect::HandleSpiritOfRedemption(), Kill(), Creature::setDeathState(), and Player::setDeathState().

◆ SetDisableGravity()

void Unit::SetDisableGravity ( bool  disable)
16667{
16668 bool isClientControlled = IsClientControlled();
16669
16670 if (!isClientControlled)
16671 {
16672 if (enable)
16674 else
16676 }
16677
16678 if (!IsInWorld()) // is sent on add to map
16679 return;
16680
16681 if (isClientControlled)
16682 {
16683 if (Player const* player = GetClientControlling())
16684 {
16685 uint32 const counter = player->GetSession()->GetOrderCounter();
16686
16688 data << GetPackGUID();
16689 data << counter;
16690 player->GetSession()->SendPacket(&data);
16691 player->GetSession()->IncrementOrderCounter();
16692 return;
16693 }
16694 }
16695
16697 data << GetPackGUID();
16698 SendMessageToSet(&data, true);
16699}
@ SMSG_SPLINE_MOVE_GRAVITY_DISABLE
Definition Opcodes.h:1265
@ SMSG_MOVE_GRAVITY_DISABLE
Definition Opcodes.h:1260
@ SMSG_MOVE_GRAVITY_ENABLE
Definition Opcodes.h:1262
@ SMSG_SPLINE_MOVE_GRAVITY_ENABLE
Definition Opcodes.h:1266

References MovementInfo::AddMovementFlag(), GetClientControlling(), Object::GetPackGUID(), IsClientControlled(), Object::IsInWorld(), WorldObject::m_movementInfo, MOVEMENTFLAG_DISABLE_GRAVITY, MovementInfo::RemoveMovementFlag(), WorldObject::SendMessageToSet(), PackedGuid::size(), SMSG_MOVE_GRAVITY_DISABLE, SMSG_MOVE_GRAVITY_ENABLE, SMSG_SPLINE_MOVE_GRAVITY_DISABLE, and SMSG_SPLINE_MOVE_GRAVITY_ENABLE.

Referenced by boss_twin_valkyrAI::boss_twin_valkyrAI(), boss_yoggsaron_brain::boss_yoggsaron_brain(), boss_the_lurker_below::DamageTaken(), boss_the_lich_king::boss_the_lich_kingAI::DamageTaken(), boss_nightbane::DoAction(), boss_kirtonos_the_herald::boss_kirtonos_the_heraldAI::DoAction(), boss_taldaram::DoAction(), npc_ball_of_flame::npc_ball_of_flameAI::DoAction(), npc_high_overlord_saurfang_icc::npc_high_overlord_saurfangAI::DoAction(), npc_muradin_bronzebeard_icc::npc_muradin_bronzebeard_iccAI::DoAction(), boss_sindragosa::boss_sindragosaAI::DoAction(), boss_algalon_the_observer::DoAction(), npc_madrigosa::DoAction(), boss_kalecgos::DoAction(), npc_kalecgos_kj::DoAction(), boss_illidan_stormrage::DoAction(), boss_nightbane::EnterEvadeMode(), boss_malygos::EnterEvadeMode(), boss_urom::boss_uromAI::EnterEvadeMode(), boss_razorscale::EnterEvadeMode(), boss_kaelthas::ExecuteMiddleEvent(), npc_pet_dk_ebon_gargoyle::FlyAway(), boss_blood_queen_lana_thel::boss_blood_queen_lana_thelAI::GoToMinchar(), npc_anachronos_the_ancient::npc_anachronos_the_ancientAI::HandleAnimation(), debug_commandscript::HandleDebugMoveflagsCommand(), spell_gen_gryphon_wyvern_mount_check::HandleEffectPeriodic(), boss_sartharion_dragonAI::HandleExtraEvent(), spell_the_lich_king_valkyr_target_search::HandleScript(), boss_felmyst::InitializeAI(), boss_taldaram::InitializeAI(), npc_icc_nerubar_broodkeeper::npc_icc_nerubar_broodkeeperAI::InitializeAI(), boss_malygos::InitializeAI(), boss_razorscale::InitializeAI(), npc_pet_dk_ebon_gargoyle::InitializeAI(), boss_urom::boss_uromAI::JustDied(), boss_kologarn::JustDied(), boss_ayamiss::JustEngagedWith(), boss_jeklik::JustEngagedWith(), boss_saviana_ragefire::boss_saviana_ragefireAI::JustReachedHome(), npc_spinestalker::npc_spinestalkerAI::JustReachedHome(), npc_rimefang::npc_rimefangAI::JustReachedHome(), npc_icc_spire_frostwyrm::JustReachedHome(), boss_ingvar_the_plunderer::JustSummoned(), boss_kiljaeden::JustSummoned(), npc_icc_gauntlet_controller::npc_icc_gauntlet_controllerAI::JustSummoned(), npc_lady_sylvanas_windrunner::npc_lady_sylvanas_windrunnerAI::JustSummoned(), boss_algalon_the_observer::MovementInform(), npc_enslaved_netherwing_drake::MovementInform(), boss_onyxia::MovementInform(), boss_ayamiss::MovementInform(), boss_taldaram::MovementInform(), boss_blood_queen_lana_thel::boss_blood_queen_lana_thelAI::MovementInform(), boss_sister_svalna::boss_sister_svalnaAI::MovementInform(), npc_icc_spire_frostwyrm::MovementInform(), npc_icc_nerubar_broodkeeper::npc_icc_nerubar_broodkeeperAI::MovementInform(), boss_malygos::MovementInform(), npc_oculus_drake::npc_oculus_drakeAI::MovementInform(), boss_razorscale::MovementInform(), boss_illidan_stormrage::MovementInform(), boss_nazan::MovementInform(), boss_felmyst::MovementInform(), npc_hallows_end_soh::MovementInform(), boss_headless_horseman::MovementInform(), boss_saviana_ragefire::boss_saviana_ragefireAI::MovementInform(), boss_sindragosa::boss_sindragosaAI::MovementInform(), npc_spinestalker::npc_spinestalkerAI::MovementInform(), npc_rimefang::npc_rimefangAI::MovementInform(), boss_kaelthas::MovementInform(), npc_pet_dk_ebon_gargoyle::MovementInform(), boss_sartharion_dragonAI::MovementInform(), boss_jedoga_shadowseeker::MovementInform(), npc_alexstrasza::npc_alexstrasza(), npc_attracted_reef_bull::npc_attracted_reef_bullAI::npc_attracted_reef_bullAI(), npc_concentrated_ball::npc_concentrated_ballAI::npc_concentrated_ballAI(), npc_gothik_trigger::npc_gothik_triggerAI::npc_gothik_triggerAI(), npc_icc_nerubar_broodkeeper::npc_icc_nerubar_broodkeeperAI::npc_icc_nerubar_broodkeeperAI(), npc_korkron_or_wildhammer::npc_korkron_or_wildhammer(), npc_nightbane_helper_target::npc_nightbane_helper_target(), npc_pet_gen_moth::npc_pet_gen_moth(), npc_pet_gen_valkyr_guardian::npc_pet_gen_valkyr_guardian(), npc_ulduar_aerial_command_unit::npc_ulduar_aerial_command_unit(), spell_chapter5_light_of_dawn_aura::OnApply(), instance_ulduar::instance_ulduar_InstanceMapScript::OnCreatureCreate(), spell_q12779_an_end_to_all_things_devour_aura::OnRemove(), spell_chapter5_light_of_dawn_aura::OnRemove(), npc_vehicle_d16_propelled_delivery::npc_vehicle_d16_propelled_deliveryAI::PassengerBoarded(), npc_eoe_wyrmrest_skytalon::PassengerBoarded(), npc_oculus_drake::npc_oculus_drakeAI::PassengerBoarded(), boss_nightbane::PathEndReached(), boss_jeklik::PathEndReached(), boss_nefarian::PathEndReached(), SmartScript::ProcessAction(), boss_nefarian::Reset(), boss_kalecgos::Reset(), npc_akilzon_eagle::Reset(), boss_jeklik::Reset(), npc_soh_fire_trigger::Reset(), npc_hallows_end_soh::Reset(), boss_headless_horseman::Reset(), boss_onyxia::Reset(), boss_ayamiss::Reset(), boss_jedoga_shadowseeker::Reset(), boss_sartharion_dragonAI::Reset(), npc_blood_queen_lana_thel::npc_blood_queen_lana_thelAI::Reset(), boss_blood_queen_lana_thel::boss_blood_queen_lana_thelAI::Reset(), npc_spinestalker::npc_spinestalkerAI::Reset(), npc_rimefang::npc_rimefangAI::Reset(), boss_sister_svalna::boss_sister_svalnaAI::Reset(), npc_icc_spire_frostwyrm::Reset(), boss_stormcaller_brundir::Reset(), boss_kologarn::Reset(), boss_thorim_pillar::Reset(), boss_yoggsaron_sara::Reset(), boss_illidan_stormrage::Reset(), boss_nazan::Reset(), boss_kaelthas::Reset(), npc_enslaved_netherwing_drake::Reset(), npc_dancing_flames::npc_dancing_flamesAI::Reset(), boss_felmyst::ScheduleGroundAbilities(), Creature::setDeathState(), npc_high_overlord_saurfang_icc::npc_high_overlord_saurfangAI::SpellHit(), npc_muradin_bronzebeard_icc::npc_muradin_bronzebeard_iccAI::SpellHit(), npc_saurfang_event::npc_saurfang_eventAI::SpellHit(), boss_urom::boss_uromAI::SpellHit(), npc_enslaved_netherwing_drake::SpellHit(), boss_felmyst::StartIntro(), boss_nightbane::TriggerHealthTakeOff(), boss_kirtonos_the_herald::boss_kirtonos_the_heraldAI::UpdateAI(), npc_madrigosa::UpdateAI(), npc_highborne_lamenter::npc_highborne_lamenterAI::UpdateAI(), boss_headless_horseman::UpdateAI(), boss_onyxia::UpdateAI(), boss_jedoga_shadowseeker::UpdateAI(), boss_saviana_ragefire::boss_saviana_ragefireAI::UpdateAI(), boss_krick::boss_krickAI::UpdateAI(), boss_blood_queen_lana_thel::boss_blood_queen_lana_thelAI::UpdateAI(), boss_sindragosa::boss_sindragosaAI::UpdateAI(), npc_rimefang::npc_rimefangAI::UpdateAI(), npc_valkyr_shadowguard::npc_valkyr_shadowguardAI::UpdateAI(), boss_sapphiron::boss_sapphironAI::UpdateAI(), boss_malygos::UpdateAI(), boss_urom::boss_uromAI::UpdateAI(), npc_oculus_drake::npc_oculus_drakeAI::UpdateAI(), boss_stormcaller_brundir::UpdateAI(), boss_mimiron::UpdateAI(), boss_razorscale::UpdateAI(), npc_wintergarde_gryphon::UpdateAI(), npc_pet_gen_wind_rider_cub::UpdateAI(), and Creature::UpdateMovementFlags().

◆ SetDisplayId()

◆ SetDualWieldMode()

virtual void Unit::SetDualWieldMode ( DualWieldMode  mode)
inlinevirtual
969{ _dualWieldMode = mode; }

References _dualWieldMode.

Referenced by Creature::InitEntry(), and Creature::UpdateEntry().

◆ SetEmoteState()

void Unit::SetEmoteState ( Emote  emoteState)
inline

◆ SetExtraUnitMovementFlags()

void Unit::SetExtraUnitMovementFlags ( uint16  f)
inline

◆ SetFacingTo()

void Unit::SetFacingTo ( float  ori)
16616{
16617 Movement::MoveSplineInit init(this);
16618 init.MoveTo(GetPositionX(), GetPositionY(), GetPositionZ(), false);
16620 init.DisableTransportPathTransformations(); // It makes no sense to target global orientation
16621 init.SetFacing(ori);
16622 init.Launch();
16623}
bool HasUnitMovementFlag(uint32 f) const
Definition Unit.h:768
ObjectGuid GetTransGUID() const override
Definition Unit.cpp:15122

References Movement::MoveSplineInit::DisableTransportPathTransformations(), Position::GetPositionX(), Position::GetPositionY(), Position::GetPositionZ(), GetTransGUID(), HasUnitMovementFlag(), Movement::MoveSplineInit::Launch(), MOVEMENTFLAG_ONTRANSPORT, Movement::MoveSplineInit::MoveTo(), and Movement::MoveSplineInit::SetFacing().

Referenced by boss_twinemperorsAI::DoAction(), npc_arthas::npc_arthasAI::DoAction(), Spell::EffectDistract(), UtherBatteredHiltEvent::Execute(), boss_kaelthas::ExecuteMiddleEvent(), DistractMovementGenerator::Finalize(), Creature::FocusTarget(), spell_item_unusual_compass::HandleDummy(), spell_drakkari_colossus_face_me::HandleScriptEffect(), boss_grand_warlock_nethekurse::IntroRP(), npc_hyjal_jaina::hyjalJainaAI::IsSummonedBy(), boss_ragnaros::boss_ragnarosAI::JustDied(), boss_ingvar_the_plunderer::JustSummoned(), boss_nalorakk::MoveInLineOfSight(), boss_algalon_the_observer::MovementInform(), npc_brann_bronzebeard_algalon::MovementInform(), boss_zuljin::MovementInform(), npc_harrison_jones::MovementInform(), boss_onyxia::MovementInform(), npc_twilight_volunteer::MovementInform(), boss_eadric::boss_eadricAI::MovementInform(), boss_paletress::boss_paletressAI::MovementInform(), boss_grand_champion::boss_grand_championAI::MovementInform(), npc_pos_deathwhisper_necrolyte::npc_pos_deathwhisper_necrolyteAI::MovementInform(), boss_professor_putricide::boss_professor_putricideAI::MovementInform(), boss_razorscale::MovementInform(), npc_enslaved_proto_drake::MovementInform(), npc_commander_eligor_dawnbringer::npc_commander_eligor_dawnbringerAI::MovementInform(), boss_illidan_stormrage::MovementInform(), boss_essence_of_suffering::boss_essence_of_sufferingAI::MovementInform(), boss_essence_of_desire::boss_essence_of_desireAI::MovementInform(), boss_lady_vashj::MovementInform(), boss_mr_smite::boss_mr_smiteAI::MovementInform(), boss_saviana_ragefire::boss_saviana_ragefireAI::MovementInform(), boss_sindragosa::boss_sindragosaAI::MovementInform(), npc_spinestalker::npc_spinestalkerAI::MovementInform(), npc_rimefang::npc_rimefangAI::MovementInform(), boss_jedoga_shadowseeker::MovementInform(), gunship_npc_AI::MovementInform(), npc_gunship_boarding_addAI::MovementInform(), npc_gunship_mage::npc_gunship_mageAI::MovementInform(), boss_the_lich_king::boss_the_lich_kingAI::MovementInform(), boss_skadi_grauf::boss_skadi_graufAI::MovementInform(), spell_lurker_below_spout::OnPeriodic(), npc_hover_disk::PassengerBoarded(), SmartAI::PausePath(), SmartScript::ProcessAction(), instance_culling_of_stratholme::instance_culling_of_stratholme_InstanceMapScript::Reposition(), instance_old_hillsbrad::instance_old_hillsbrad_InstanceMapScript::Reposition(), boss_illidan_stormrage::ScheduleAbilities(), boss_nightbane::ScheduleFly(), Player::SetClientControl(), boss_grand_warlock_nethekurse::SetData(), npc_tirion_fordring_tft::npc_tirion_fordringAI::SpellHit(), npc_chesspiece::SpellHitTarget(), boss_heigan::StartFightPhase(), CreatureAI::TriggerAlert(), RotateMovementGenerator::Update(), boss_rend_blackhand::boss_rend_blackhandAI::UpdateAI(), boss_victor_nefarius::boss_victor_nefariusAI::UpdateAI(), npc_highlord_darion_mograine::npc_highlord_darion_mograineAI::UpdateAI(), boss_kirtonos_the_herald::boss_kirtonos_the_heraldAI::UpdateAI(), npc_partygoer::UpdateAI(), npc_bh_thalorien_dawnseeker::npc_bh_thalorien_dawnseekerAI::UpdateAI(), npc_arthas::npc_arthasAI::UpdateAI(), npc_thrall_old_hillsbrad::npc_thrall_old_hillsbradAI::UpdateAI(), npc_medivh_bm::UpdateAI(), boss_onyxia::UpdateAI(), npc_hadronox_crusherPackAI::UpdateAI(), npc_frost_sphere::npc_frost_sphereAI::UpdateAI(), npc_hor_leader_second::npc_hor_leader_secondAI::UpdateAI(), boss_krick::boss_krickAI::UpdateAI(), npc_pos_tyrannus_events::npc_pos_tyrannus_eventsAI::UpdateAI(), npc_pos_martin_or_gorkun_second::npc_pos_martin_or_gorkun_secondAI::UpdateAI(), boss_the_lich_king::boss_the_lich_kingAI::UpdateAI(), boss_malygos::UpdateAI(), boss_varos::boss_varosAI::UpdateAI(), npc_ulduar_vx001::UpdateAI(), boss_svala::boss_svalaAI::UpdateAI(), npc_bloodmage_laurith::npc_bloodmage_laurithAI::UpdateAI(), npc_millhouse_manastorm::npc_millhouse_manastormAI::UpdateAI(), npc_warden_mellichar::npc_warden_mellicharAI::UpdateAI(), npc_pet_gen_plump_turkey::UpdateAI(), npc_general_andorov::UpdateEscortAI(), npc_tirions_gambit_tirion::npc_tirions_gambit_tirionAI::UpdateEscortAI(), npc_black_knight_skeletal_gryphon::npc_black_knight_skeletal_gryphonAI::WaypointReached(), npc_argent_soldier::npc_argent_soldierAI::WaypointReached(), npc_ranger_lilatha::WaypointReached(), npc_thrall_old_hillsbrad::npc_thrall_old_hillsbradAI::WaypointReached(), and npc_ancestral_wolf::npc_ancestral_wolfAI::WaypointReached().

◆ SetFacingToObject()

void Unit::SetFacingToObject ( WorldObject object,
Milliseconds  timed = 0ms 
)
Todo:
figure out under what conditions creature will move towards object instead of facing it where it currently is.
16626{
16627 // never face when already moving
16628 if (!IsStopped())
16629 return;
16630
16632 Movement::MoveSplineInit init(this);
16633 init.MoveTo(GetPositionX(), GetPositionY(), GetPositionZ());
16634 init.SetFacing(GetAngle(object)); // when on transport, GetAngle will still return global coordinates (and angle) that needs transforming
16635 init.Launch();
16636
16637 if (timed > 0ms)
16638 {
16639 if (Creature* c = ToCreature())
16640 {
16641 c->m_Events.AddEventAtOffset([c]()
16642 {
16643 if (c->IsInWorld() && c->FindMap() && c->IsAlive() && !c->IsInCombat())
16644 c->SetFacingTo(c->GetHomePosition().GetOrientation());
16645 }, timed);
16646 }
16647 else
16648 LOG_ERROR("entities.unit", "Unit::SetFacingToObject called on non-creature unit {}. This should never happen.", GetEntry());
16649 }
16650}
bool IsStopped() const
Definition Unit.h:1746

References Position::GetAngle(), Object::GetEntry(), Position::GetPositionX(), Position::GetPositionY(), Position::GetPositionZ(), IsStopped(), Movement::MoveSplineInit::Launch(), LOG_ERROR, Movement::MoveSplineInit::MoveTo(), Movement::MoveSplineInit::SetFacing(), and Object::ToCreature().

Referenced by boss_razuvious_minion::boss_razuvious_minionAI::DoAction(), npc_ranshalla::npc_ranshallaAI::DoChannelTorchSpell(), npc_forest_frog::DoSpawnRandom(), Spell::EffectSummonType(), spell_chapter5_return_to_capital::HandleHit(), spell_yogg_saron_target_selectors::HandleScript(), npc_vaelastrasz_the_red::npc_vaelastrasz_the_redAI::IsSummonedBy(), npc_oculus_drake::npc_oculus_drakeAI::IsSummonedBy(), npc_wintergarde_gryphon::IsSummonedBy(), npc_maiev_illidan::IsSummonedBy(), npc_ranshalla::npc_ranshallaAI::JustDidDialogueStep(), npc_ravenclaw_apparition::npc_ravenclaw_apparitionAI::JustSummoned(), npc_overlord_drakuru_betrayal::JustSummoned(), boss_illidan_stormrage::JustSummoned(), npc_acherus_necromancer::npc_acherus_necromancerAI::MovementInform(), npc_gothik_the_harvester::npc_gothik_the_harvesterAI::MovementInform(), boss_zuljin::MovementInform(), npc_harrison_jones::MovementInform(), npc_akama_illidan::MovementInform(), npc_hor_lich_king::npc_hor_lich_kingAI::MovementInform(), npc_dragonmaw_peon::npc_dragonmaw_peonAI::MovementInform(), npc_hidden_cultist::npc_hidden_cultistAI::PreScript(), npc_jungle_punch_target::npc_jungle_punch_targetAI::proceedCwEvent(), SmartScript::ProcessAction(), npc_lake_frog::npc_lake_frogAI::ReceiveEmote(), npc_dancing_flames::npc_dancing_flamesAI::ReceiveEmote(), npc_image_of_medivh::npc_image_of_medivhAI::Reset(), boss_razuvious_minion::boss_razuvious_minionAI::ScheduleAttackDummy(), boss_nightbane::ScheduleFly(), boss_razuvious::boss_razuviousAI::ScheduleInteractWithDeathKnight(), boss_the_lurker_below::SchedulerPhaseOne(), boss_shade_of_aran::SetGUID(), npc_bloodmage_laurith::npc_bloodmage_laurithAI::SetGUID(), npc_harrison_jones::sGossipSelect(), npc_crusade_recruit::npc_crusade_recruitAI::sGossipSelect(), npc_death_knight_initiate::npc_death_knight_initiateAI::SpellHit(), npc_wounded_skirmisher::SpellHit(), boss_devourer_of_souls::boss_devourer_of_soulsAI::SpellHitTarget(), npc_magister_aledis::StartFight(), boss_hydross_the_unstable::SummonMovementInform(), npc_commander_dawnforge::npc_commander_dawnforgeAI::Turn_to_eachother(), npc_commander_dawnforge::npc_commander_dawnforgeAI::Turn_to_Pathaleons_Image(), npc_rookery_hatcher::npc_rookery_hatcherAI::UpdateAI(), boss_victor_nefarius::boss_victor_nefariusAI::UpdateAI(), boss_majordomo::boss_majordomoAI::UpdateAI(), npc_acherus_necromancer::npc_acherus_necromancerAI::UpdateAI(), npc_gothik_the_harvester::npc_gothik_the_harvesterAI::UpdateAI(), npc_highlord_darion_mograine::npc_highlord_darion_mograineAI::UpdateAI(), npc_eastvale_peasent::UpdateAI(), npc_partygoer::UpdateAI(), npc_thrall_bfu::npc_thrall_bfuAI::UpdateAI(), npc_winterfin_playmate::UpdateAI(), npc_snowfall_glade_playmate::UpdateAI(), npc_the_biggest_tree::UpdateAI(), npc_high_oracle_soo_roo::UpdateAI(), npc_the_etymidian::UpdateAI(), npc_alexstraza_the_lifebinder::UpdateAI(), npc_pilgrims_bounty_chair::UpdateAI(), npc_arthas::npc_arthasAI::UpdateAI(), npc_thrall_old_hillsbrad::npc_thrall_old_hillsbradAI::UpdateAI(), boss_onyxia::UpdateAI(), boss_icehowl::boss_icehowlAI::UpdateAI(), boss_bronjahm::boss_bronjahmAI::UpdateAI(), npc_hor_leader_second::npc_hor_leader_secondAI::UpdateAI(), boss_professor_putricide::boss_professor_putricideAI::UpdateAI(), boss_rotface::boss_rotfaceAI::UpdateAI(), npc_rimefang::npc_rimefangAI::UpdateAI(), npc_tirion_fordring_tft::npc_tirion_fordringAI::UpdateAI(), boss_malygos::UpdateAI(), npc_ulduar_vx001::UpdateAI(), npc_ulduar_expedition_engineer::UpdateAI(), npc_hidden_cultist::npc_hidden_cultistAI::UpdateAI(), npc_deaths_fel_cannon::npc_deaths_fel_cannonAI::UpdateAI(), npc_ranshalla::npc_ranshallaAI::WaypointReached(), npc_arthas::npc_arthasAI::WaypointReached(), and npc_kaya_flathoof::npc_kaya_flathoofAI::WaypointReached().

◆ SetFaction()

void Unit::SetFaction ( uint32  faction)
7021{
7023 if (IsCreature())
7025}
void UpdateMoveInLineOfSightState()
Definition Creature.cpp:2546

References Object::IsCreature(), SetUInt32Value(), Object::ToCreature(), UNIT_FIELD_FACTIONTEMPLATE, and Creature::UpdateMoveInLineOfSightState().

Referenced by npc_hidden_cultist::npc_hidden_cultistAI::AttackPlayer(), GameObject::CastSpell(), boss_eadric::boss_eadricAI::DamageTaken(), boss_paletress::boss_paletressAI::DamageTaken(), boss_algalon_the_observer::DamageTaken(), boss_freya::DamageTaken(), boss_hodir::DamageTaken(), npc_ulduar_arachnopod_destroyer::DamageTaken(), npc_overlord_drakuru_betrayal::DamageTaken(), boss_thorim::DamageTaken(), npc_weegli_blastfuse::npc_weegli_blastfuseAI::DestroyDoor(), boss_apothecary_hummel::boss_apothecary_hummelAI::DoAction(), npc_apothecary_genericAI::DoAction(), npc_coren_direbrew::DoAction(), npc_direbrew_antagonist::DoAction(), boss_algalon_the_observer::DoAction(), boss_kalecgos::DoAction(), npc_taskmaster_fizzule::npc_taskmaster_fizzuleAI::DoFriend(), npc_unkor_the_ruthless::npc_unkor_the_ruthlessAI::DoNice(), Spell::EffectSummonType(), npc_overlord_drakuru_betrayal::EnterEvadeMode(), BattlegroundEY::EventTeamCapturedPoint(), AuraEffect::HandleAuraModFaction(), BattlegroundIC::HandleCapturedNodes(), spell_q12096_q12092_dummy::HandleDummy(), spell_q11919_q11940_drake_hunt_aura::HandleEffectRemove(), modify_commandscript::HandleModifyFactionCommand(), npc_commandscript::HandleNpcSetFactionIdCommand(), npc_commandscript::HandleNpcSetFactionTempIdCommand(), spell_mutate_explode_bug::HandleOnHit(), spell_q10612_10613_the_fel_and_the_furious::HandleScriptEffect(), spell_item_draenic_pale_ale::HandleSummon(), npc_cork_gizelton::npc_cork_gizeltonAI::ImmuneFlagSet(), boss_vaelastrasz::boss_vaelAI::Initialize(), boss_majordomo::boss_majordomoAI::InitializeAI(), npc_general_andorov::InitializeAI(), npc_sergeant_bly::npc_sergeant_blyAI::InitializeAI(), Minion::InitStats(), TempSummon::InitStats(), InitTamedPet(), npc_infra_green_bomber_generic::npc_infra_green_bomber_genericAI::IsSummonedBy(), npc_enraged_spirit::npc_enraged_spiritAI::JustDied(), FollowerAI::JustRespawned(), npc_eris_hevenfire::npc_eris_hevenfireAI::JustSummoned(), boss_volkhan::JustSummoned(), boss_balinda::JustSummoned(), npc_thrall_bfu::npc_thrall_bfuAI::JustSummoned(), boss_archimonde::JustSummoned(), boss_broggok::JustSummoned(), Pet::LoadPetFromDB(), boss_twilight_corrupter::MoveInLineOfSight(), npc_akama_shade::MovementInform(), BattlegroundAB::NodeOccupied(), spell_brewfest_reveler_transform::OnApply(), npc_chesspiece::OnCharmed(), BattlefieldWG::OnCreatureCreate(), instance_blackrock_depths::instance_blackrock_depths_InstanceMapScript::OnCreatureCreate(), instance_nexus::instance_nexus_InstanceMapScript::OnCreatureCreate(), instance_oculus::instance_oculus_InstanceMapScript::OnCreatureCreate(), instance_black_temple::instance_black_temple_InstanceMapScript::OnCreatureCreate(), boss_azuregos::OnGossipSelect(), InstanceScript::OnPlayerEnter(), npc_prospector_remtravel::OnQuestAccept(), npc_gilthares::OnQuestAccept(), npc_lakota_windsong::OnQuestAccept(), npc_paoka_swiftmountain::OnQuestAccept(), npc_engineer_helice::OnQuestAccept(), npc_maghar_captive::OnQuestAccept(), npc_maxx_a_million_escort::OnQuestAccept(), npc_kaya_flathoof::OnQuestAccept(), npc_wizzlecrank_shredder::OnQuestAccept(), npc_ame::OnQuestAccept(), npc_ranshalla::OnQuestAccept(), npc_lurgglbr::OnQuestAccept(), npc_mootoo_the_younger::OnQuestAccept(), npc_apothecary_hanes::OnQuestAccept(), npc_bessy::OnQuestAccept(), npc_isla_starmane::OnQuestAccept(), go_crystalline_tear::OnQuestAccept(), npc_ulduar_arachnopod_destroyer::PassengerBoarded(), npc_frosthound::PassengerBoarded(), BattlegroundAV::PopulateNode(), npc_chicken_cluck::npc_chicken_cluckAI::ReceiveEmote(), npc_plucky::npc_pluckyAI::ReceiveEmote(), RemoveCharmedBy(), boss_doomrel::boss_doomrelAI::Reset(), boss_victor_nefarius::boss_victor_nefariusAI::Reset(), npc_unworthy_initiate::npc_unworthy_initiateAI::Reset(), boss_darkmaster_gandling::boss_darkmaster_gandlingAI::Reset(), boss_apothecary_hummel::boss_apothecary_hummelAI::Reset(), npc_coren_direbrew::Reset(), npc_direbrew_minion::Reset(), npc_aquementas::npc_aquementasAI::Reset(), npc_taskmaster_fizzule::npc_taskmaster_fizzuleAI::Reset(), npc_plucky::npc_pluckyAI::Reset(), boss_grobbulus_poison_cloud::boss_grobbulus_poison_cloudAI::Reset(), boss_algalon_the_observer::Reset(), npc_future_you::npc_future_youAI::Reset(), npc_overlord_drakuru_betrayal::Reset(), npc_akama_shade::Reset(), npc_aeranas::npc_aeranasAI::Reset(), npc_unkor_the_ruthless::npc_unkor_the_ruthlessAI::Reset(), npc_chicken_cluck::npc_chicken_cluckAI::Reset(), RestoreFaction(), SetCharmedBy(), Player::SetFactionForRace(), Player::SetGameMaster(), npc_captain_saeed::npc_captain_saeedAI::SetGUID(), BattlegroundIC::SetupBattleground(), boss_victor_nefarius::boss_victor_nefariusAI::sGossipSelect(), Battlefield::SpawnCreature(), npc_rabid_thistle_bear::npc_rabid_thistle_bearAI::SpellHit(), npc_isle_of_conquest_turret::npc_isle_of_conquest_turretAI::SpellHit(), npc_enslaved_netherwing_drake::SpellHit(), npc_belnistrasz::npc_belnistraszAI::sQuestAccept(), npc_professor_phizzlethorpe::npc_professor_phizzlethorpeAI::sQuestAccept(), npc_ranger_lilatha::sQuestAccept(), npc_corporal_keeshan::npc_corporal_keeshanAI::sQuestAccept(), npc_muglash::npc_muglashAI::sQuestAccept(), npc_wounded_blood_elf::npc_wounded_blood_elfAI::sQuestAccept(), FollowerAI::StartFollow(), npc_deathstalker_fearleia::SummonCreatureWithRandomTarget(), boss_majordomo::boss_majordomoAI::SummonedCreatureDies(), Spell::SummonGuardian(), Player::SummonPet(), WorldObject::SummonTrigger(), npc_vaelastrasz_the_red::npc_vaelastrasz_the_redAI::UpdateAI(), boss_vaelastrasz::boss_vaelAI::UpdateAI(), npc_death_knight_initiate::npc_death_knight_initiateAI::UpdateAI(), npc_unworthy_initiate::npc_unworthy_initiateAI::UpdateAI(), npc_madrigosa::UpdateAI(), npc_aquementas::npc_aquementasAI::UpdateAI(), npc_twiggy_flathead::npc_twiggy_flatheadAI::UpdateAI(), npc_sergeant_bly::npc_sergeant_blyAI::UpdateAI(), boss_algalon_the_observer::UpdateAI(), boss_mimiron::UpdateAI(), npc_aeranas::npc_aeranasAI::UpdateAI(), npc_magister_aledis::UpdateAI(), npc_lord_gregor_lescovar::npc_lord_gregor_lescovarAI::UpdateAI(), Creature::UpdateEntry(), npc_magwin::npc_magwinAI::UpdateEscortAI(), and npc_tapoke_slim_jahn::npc_tapoke_slim_jahnAI::WaypointReached().

◆ SetFeared()

void Unit::SetFeared ( bool  apply,
Unit fearedBy = nullptr,
bool  isFear = false 
)
protected
14651{
14652 if (apply)
14653 {
14654 SetTarget();
14655 GetMotionMaster()->MoveFleeing(fearedBy, isFear ? 0 : sWorld->getIntConfig(CONFIG_CREATURE_FAMILY_FLEE_DELAY));
14656 }
14657 else
14658 {
14659 if (IsAlive())
14660 {
14661 if (GetMotionMaster()->GetMotionSlotType(MOTION_SLOT_CONTROLLED) == FLEEING_MOTION_TYPE)
14662 {
14664 StopMoving();
14665 }
14666
14667 if (GetVictim())
14669 }
14670 }
14671
14672 // xinef: block / allow control to real mover (eg. charmer)
14673 if (IsPlayer())
14674 {
14675 if (m_movedByPlayer)
14676 m_movedByPlayer->ToPlayer()->SetClientControl(this, !apply); // verified
14677 //else
14678 // ToPlayer()->SetClientControl(this, !apply);
14679 }
14680}
@ FLEEING_MOTION_TYPE
Definition MotionMaster.h:49
@ CONFIG_CREATURE_FAMILY_FLEE_DELAY
Definition WorldConfig.h:238
void MoveFleeing(Unit *enemy, uint32 time=0)
Enable the target's fleeing movement. Doesn't work with UNIT_FLAG_DISABLE_MOVE.
Definition MotionMaster.cpp:795

References CONFIG_CREATURE_FAMILY_FLEE_DELAY, FLEEING_MOTION_TYPE, Object::GetGUID(), GetMotionMaster(), MotionMaster::GetMotionSlotType(), GetVictim(), IsAlive(), Object::IsPlayer(), m_movedByPlayer, MOTION_SLOT_CONTROLLED, MotionMaster::MoveFleeing(), MotionMaster::MovementExpired(), Player::SetClientControl(), SetTarget(), StopMoving(), sWorld, and Object::ToPlayer().

Referenced by SetControlled().

◆ SetFeatherFall()

void Unit::SetFeatherFall ( bool  enable)
16763{
16764 bool isClientControlled = IsClientControlled();
16765
16766 if (!isClientControlled)
16767 {
16768 if (enable)
16770 else
16772 }
16773
16774 if (!IsInWorld()) // is sent on add to map
16775 return;
16776
16777 if (isClientControlled)
16778 {
16779 if (Player const* player = GetClientControlling())
16780 {
16781 uint32 const counter = player->GetSession()->GetOrderCounter();
16782
16784
16785 data << GetPackGUID();
16786 data << counter;
16787 player->SendDirectMessage(&data);
16788 player->GetSession()->IncrementOrderCounter();
16789
16790 // start fall from current height
16791 if (!enable)
16792 const_cast<Player*>(player)->SetFallInformation(0, GetPositionZ());
16793
16794 return;
16795 }
16796 }
16797
16799 data << GetPackGUID();
16800 SendMessageToSet(&data, true);
16801}
@ MOVEMENTFLAG_FALLING_SLOW
Definition UnitDefines.h:398
@ SMSG_MOVE_FEATHER_FALL
Definition Opcodes.h:272
@ SMSG_MOVE_NORMAL_FALL
Definition Opcodes.h:273
@ SMSG_SPLINE_MOVE_NORMAL_FALL
Definition Opcodes.h:804

References MovementInfo::AddMovementFlag(), GetClientControlling(), Object::GetPackGUID(), Position::GetPositionZ(), IsClientControlled(), Object::IsInWorld(), WorldObject::m_movementInfo, MOVEMENTFLAG_FALLING_SLOW, MovementInfo::RemoveMovementFlag(), WorldObject::SendMessageToSet(), PackedGuid::size(), SMSG_MOVE_FEATHER_FALL, SMSG_MOVE_NORMAL_FALL, SMSG_SPLINE_MOVE_FEATHER_FALL, and SMSG_SPLINE_MOVE_NORMAL_FALL.

Referenced by AuraEffect::HandleAuraFeatherFall(), and debug_commandscript::HandleDebugMoveflagsCommand().

◆ SetFullHealth()

◆ SetHealth()

void Unit::SetHealth ( uint32  val)
12489{
12491 val = 0;
12492 else if (IsPlayer() && getDeathState() == DeathState::Dead)
12493 val = 1;
12494 else
12495 {
12496 uint32 maxHealth = GetMaxHealth();
12497 if (maxHealth < val)
12498 val = maxHealth;
12499 }
12500
12501 float prevHealthPct = GetHealthPct();
12502
12504
12505 // mobs that are now or were below 30% need to update their speed
12506 if (IsCreature() && !(IsPet() && ToPet()->isControlled() && IsControlledByPlayer()) && (prevHealthPct < 30.0 || HealthBelowPct(30)))
12507 {
12508 UpdateSpeed(MOVE_RUN, false);
12509 }
12510
12511 // group update
12512 if (IsPlayer())
12513 {
12514 Player* player = ToPlayer();
12515 if (player->NeedSendSpectatorData())
12517
12518 if (player->GetGroup())
12520 }
12521 else if (Pet* pet = ToCreature()->ToPet())
12522 {
12523 if (pet->isControlled())
12524 {
12525 if (Unit* owner = GetOwner())
12526 if (Player* player = owner->ToPlayer())
12527 {
12528 if (player->NeedSendSpectatorData() && pet->GetCreatureTemplate()->family)
12529 ArenaSpectator::SendCommand_UInt32Value(player->FindMap(), player->GetGUID(), "PHP", (uint32)pet->GetHealthPct());
12530
12531 if (player->GetGroup())
12533 }
12534 }
12535 }
12536}
@ GROUP_UPDATE_FLAG_CUR_HP
Definition Group.h:101
@ GROUP_UPDATE_FLAG_PET_CUR_HP
Definition Group.h:113
bool NeedSendSpectatorData() const
Definition Player.cpp:15485
void SetGroupUpdateFlag(uint32 flag)
Definition Player.h:2507
float GetHealthPct() const
Definition Unit.h:1099
bool HealthBelowPct(int32 pct) const
Definition Unit.h:1105
void SendCommand_UInt32Value(T *o, ObjectGuid targetGUID, const char *prefix, uint32 t)
Definition ArenaSpectator.h:62

References Dead, WorldObject::FindMap(), getDeathState(), Player::GetGroup(), Object::GetGUID(), GetHealthPct(), GetMaxHealth(), GetOwner(), GROUP_UPDATE_FLAG_CUR_HP, GROUP_UPDATE_FLAG_PET_CUR_HP, HealthBelowPct(), IsControlledByPlayer(), Object::IsCreature(), IsPet(), Object::IsPlayer(), JustDied, MOVE_RUN, Player::NeedSendSpectatorData(), ArenaSpectator::SendCommand_UInt32Value(), Player::SetGroupUpdateFlag(), SetUInt32Value(), Object::ToCreature(), ToPet(), Object::ToPlayer(), UNIT_FIELD_HEALTH, and UpdateSpeed().

Referenced by Battleground::AddPlayer(), boss_twilight_halion::boss_twilight_halionAI::boss_twilight_halionAI(), Player::BuildPlayerRepop(), boss_black_knight::boss_black_knightAI::DamageTaken(), boss_alar::DamageTaken(), npc_molten_golem::DamageTaken(), boss_viscidus::DamageTaken(), boss_thorim_start_npcs::DamageTaken(), boss_thorim::DamageTaken(), boss_yoggsaron_sara::DamageTaken(), DealDamage(), boss_prince_keleseth_icc::boss_prince_kelesethAI::DoAction(), boss_prince_taldaram_icc::boss_prince_taldaramAI::DoAction(), boss_prince_valanar_icc::boss_prince_valanarAI::DoAction(), npc_terenas_menethil::npc_terenas_menethilAI::DoAction(), boss_grand_champion::boss_grand_championAI::DoAction(), boss_thaddius_summon::boss_thaddius_summonAI::DoAction(), boss_xt002::DoAction(), npc_xt002_heart::DoAction(), boss_yoggsaron::DoAction(), Spell::EffectResurrectPet(), Spell::EffectSelfResurrect(), Spell::EffectSummonPet(), Spell::EffectSummonType(), boss_prince_keleseth_icc::boss_prince_kelesethAI::EnterEvadeMode(), boss_prince_taldaram_icc::boss_prince_taldaramAI::EnterEvadeMode(), boss_prince_valanar_icc::boss_prince_valanarAI::EnterEvadeMode(), AuraEffect::HandleAuraModIncreaseHealth(), AuraEffect::HandleAuraModIncreaseHealthPercent(), AuraEffect::HandleAuraModIncreaseMaxHealth(), spell_oculus_soar_aura::HandleEffectPeriodic(), modify_commandscript::HandleModifyHPCommand(), AuraEffect::HandleModTotalPercentStat(), npc_commandscript::HandleNpcSetLevelCommand(), spell_dk_pet_scaling::HandlePeriodic(), spell_hun_generic_scaling::HandlePeriodic(), spell_mage_pet_scaling::HandlePeriodic(), spell_sha_feral_spirit_scaling::HandlePeriodic(), spell_warl_generic_scaling::HandlePeriodic(), npc_echo_of_medivh::HandlePieceJustDied(), spell_stinky_precious_decimate::HandleScript(), spell_ahune_synch_health::HandleScript(), AuraEffect::HandleSpiritOfRedemption(), npc_pet_pri_lightwell::InitializeAI(), boss_prince_keleseth_icc::boss_prince_kelesethAI::JustReachedHome(), boss_prince_taldaram_icc::boss_prince_taldaramAI::JustReachedHome(), boss_prince_valanar_icc::boss_prince_valanarAI::JustReachedHome(), npc_dirt_mound::JustSummoned(), boss_skeram::JustSummoned(), boss_attumen::JustSummoned(), boss_baltharus_the_warborn::boss_baltharus_the_warbornAI::JustSummoned(), boss_drakkari_colossus::boss_drakkari_colossusAI::JustSummoned(), boss_harbinger_skyriss::JustSummoned(), Creature::LoadCreatureFromDB(), Player::LoadFromDB(), Pet::LoadPetFromDB(), ModifyHealth(), boss_grand_champion::boss_grand_championAI::MovementInform(), npc_nether_drake::npc_nether_drakeAI::MovementInform(), npc_corrupted_totem::npc_corrupted_totem(), npc_xt002_life_spark::npc_xt002_life_spark(), instance_karazhan::instance_karazhan_InstanceMapScript::OnCreatureCreate(), instance_halls_of_reflection::instance_halls_of_reflection_InstanceMapScript::OnCreatureCreate(), Player::ProcessDelayedOperations(), boss_vaelastrasz::boss_vaelAI::Reset(), npc_draenei_survivor::npc_draenei_survivorAI::Reset(), npc_injured_draenei::npc_injured_draeneiAI::Reset(), boss_prince_keleseth_icc::boss_prince_kelesethAI::Reset(), boss_prince_taldaram_icc::boss_prince_taldaramAI::Reset(), boss_prince_valanar_icc::boss_prince_valanarAI::Reset(), boss_valithria_dreamwalker::boss_valithria_dreamwalkerAI::Reset(), boss_murmur::Reset(), npc_injured_patient::npc_injured_patientAI::Reset(), Player::ResetAllPowers(), Player::RestoreHealthAfterDuel(), Player::ResurectUsingRequestData(), Player::ResurrectPlayer(), Creature::SelectLevel(), setDeathState(), SetFullHealth(), SetMaxHealth(), boss_headless_horseman::SpellHit(), boss_black_knight::boss_black_knightAI::SpellHitTarget(), boss_malchezaar::SpellHitTarget(), npc_giant_claw_tentacle::Submerge(), boss_drakkari_colossus::boss_drakkari_colossusAI::SummonedCreatureDespawn(), npc_a_special_surprise::npc_a_special_surpriseAI::UpdateAI(), npc_nerubian_burrower::npc_nerubian_burrowerAI::UpdateAI(), npc_snobold_vassal::npc_snobold_vassalAI::UpdateAI(), npc_hor_lich_king::npc_hor_lich_kingAI::UpdateAI(), boss_garfrost::boss_garfrostAI::UpdateAI(), boss_ick::boss_ickAI::UpdateAI(), boss_tyrannus::boss_tyrannusAI::UpdateAI(), boss_prince_valanar_icc::boss_prince_valanarAI::UpdateAI(), boss_valithria_dreamwalker::boss_valithria_dreamwalkerAI::UpdateAI(), boss_flame_leviathan_defense_turret::UpdateAI(), Creature::UpdateEntry(), and boss_twin_valkyrAI::UpdateSharedHealth().

◆ SetHover()

void Unit::SetHover ( bool  enable)
16804{
16805 bool isClientControlled = IsClientControlled();
16806
16807 if (!isClientControlled)
16808 {
16809 if (enable)
16811 else
16813 }
16814
16815 float hoverHeight = GetHoverHeight();
16816
16817 if (enable)
16818 {
16819 if (hoverHeight && GetPositionZ() - GetMap()->GetHeight(GetPhaseMask(), GetPositionX(), GetPositionY(), GetPositionZ()) < hoverHeight)
16820 Relocate(GetPositionX(), GetPositionY(), GetPositionZ() + hoverHeight);
16821 }
16822 else
16823 {
16824 if (IsAlive() || !IsUnit())
16825 {
16826 float newZ = std::max<float>(GetMap()->GetHeight(GetPhaseMask(), GetPositionX(), GetPositionY(), GetPositionZ()), GetPositionZ() - hoverHeight);
16829 }
16830 }
16831
16832 if (!IsInWorld()) // is sent on add to map
16833 return;
16834
16835 if (isClientControlled)
16836 {
16837 if (Player const* player = GetClientControlling())
16838 {
16840
16841 uint32 const counter = player->GetSession()->GetOrderCounter();
16842
16843 data << GetPackGUID();
16844 data << counter;
16845 player->SendDirectMessage(&data);
16846 player->GetSession()->IncrementOrderCounter();
16847 return;
16848 }
16849 }
16850
16852 data << GetPackGUID();
16853 SendMessageToSet(&data, true);
16854}
bool IsUnit() const
Definition Object.h:208
float GetHoverHeight() const
Definition Unit.h:1701
uint32 GetPhaseMask() const
Definition Object.h:512
void UpdateAllowedPositionZ(float x, float y, float &z, float *groundZ=nullptr) const
Definition Object.cpp:1580
@ SMSG_MOVE_SET_HOVER
Definition Opcodes.h:274
@ SMSG_SPLINE_MOVE_UNSET_HOVER
Definition Opcodes.h:806
@ SMSG_MOVE_UNSET_HOVER
Definition Opcodes.h:275

References MovementInfo::AddMovementFlag(), GetClientControlling(), GetHoverHeight(), WorldObject::GetMap(), Object::GetPackGUID(), WorldObject::GetPhaseMask(), Position::GetPositionX(), Position::GetPositionY(), Position::GetPositionZ(), IsAlive(), IsClientControlled(), Object::IsInWorld(), Object::IsUnit(), WorldObject::m_movementInfo, MOVEMENTFLAG_HOVER, Position::Relocate(), MovementInfo::RemoveMovementFlag(), WorldObject::SendMessageToSet(), PackedGuid::size(), SMSG_MOVE_SET_HOVER, SMSG_MOVE_UNSET_HOVER, SMSG_SPLINE_MOVE_SET_HOVER, SMSG_SPLINE_MOVE_UNSET_HOVER, and WorldObject::UpdateAllowedPositionZ().

Referenced by boss_taldaram::DoAction(), npc_ball_of_flame::npc_ball_of_flameAI::DoAction(), boss_illidan_stormrage::DoAction(), AuraEffect::HandleAuraHover(), debug_commandscript::HandleDebugMoveflagsCommand(), boss_sartharion_dragonAI::HandleExtraEvent(), boss_taldaram::InitializeAI(), npc_frostwing_vrykul::npc_frostwing_vrykulAI::JustEngagedWith(), boss_saviana_ragefire::boss_saviana_ragefireAI::JustReachedHome(), boss_taldaram::MovementInform(), boss_illidan_stormrage::MovementInform(), boss_sartharion_dragonAI::MovementInform(), boss_jedoga_shadowseeker::MovementInform(), npc_korkron_or_wildhammer::npc_korkron_or_wildhammer(), boss_jedoga_shadowseeker::Reset(), boss_sartharion_dragonAI::Reset(), npc_dark_nucleus::npc_dark_nucleusAI::Reset(), npc_frostwing_vrykul::npc_frostwing_vrykulAI::Reset(), boss_svala::boss_svalaAI::Reset(), boss_illidan_stormrage::Reset(), setDeathState(), Creature::setDeathState(), boss_jedoga_shadowseeker::UpdateAI(), boss_stormcaller_brundir::UpdateAI(), boss_svala::boss_svalaAI::UpdateAI(), npc_wintergarde_gryphon::UpdateAI(), and Creature::UpdateMovementFlags().

◆ SetImmuneToAll()

void Unit::SetImmuneToAll ( bool  apply,
bool  keepCombat = false 
)
inline
918{ SetImmuneToPC(apply, keepCombat); SetImmuneToNPC(apply, keepCombat); }
void SetImmuneToNPC(bool apply, bool keepCombat=false)
Definition Unit.cpp:10543

References SetImmuneToNPC(), and SetImmuneToPC().

Referenced by spell_the_lich_king_trigger_vile_spirit::ActivateSpirit(), boss_chromaggus::boss_chromaggusAI::boss_chromaggusAI(), boss_nalorakk::boss_nalorakk(), boss_eadric::boss_eadricAI::DamageTaken(), boss_paletress::boss_paletressAI::DamageTaken(), boss_grand_champion::boss_grand_championAI::DamageTaken(), boss_felblood_kaelthas::DamageTaken(), npc_warden_mellichar::npc_warden_mellicharAI::DamageTaken(), boss_mal_ganis::boss_mal_ganisAI::DamageTaken(), boss_kirtonos_the_herald::boss_kirtonos_the_heraldAI::DoAction(), boss_apothecary_hummel::boss_apothecary_hummelAI::DoAction(), npc_apothecary_genericAI::DoAction(), npc_twilight_volunteer::DoAction(), boss_taldaram::DoAction(), boss_prince_keleseth_icc::boss_prince_kelesethAI::DoAction(), boss_prince_taldaram_icc::boss_prince_taldaramAI::DoAction(), boss_prince_valanar_icc::boss_prince_valanarAI::DoAction(), npc_crok_scourgebane::npc_crok_scourgebaneAI::DoAction(), brann_bronzebeard::brann_bronzebeardAI::DoAction(), npc_living_constellation::DoAction(), boss_broggok::DoAction(), boss_grand_warlock_nethekurse::DoAction(), boss_felblood_kaelthas::DoAction(), boss_grand_champion::boss_grand_championAI::DoAction(), boss_ambassador_hellmaw::DoAction(), boss_skeram::DoTeleport(), Spell::EffectSummonType(), npc_ghostly_priest::npc_ghostly_priestAI::EnterEvadeMode(), npc_phantom_mage::npc_phantom_mageAI::EnterEvadeMode(), npc_shadowy_mercenary::npc_shadowy_mercenaryAI::EnterEvadeMode(), npc_spectral_footman::npc_spectral_footmanAI::EnterEvadeMode(), npc_tortured_rifleman::npc_tortured_riflemanAI::EnterEvadeMode(), UtherBatteredHiltEvent::Execute(), spell_uldaman_stoned_aura::HandleEffectApply(), spell_uldaman_stoned_aura::HandleEffectRemove(), spell_q11919_q11940_drake_hunt_aura::HandleEffectRemove(), spell_item_draenic_pale_ale::HandleSummon(), boss_majordomo::boss_majordomoAI::InitializeAI(), boss_captain_skarloc::InitializeAI(), boss_taldaram::InitializeAI(), boss_prince_keleseth_icc::boss_prince_kelesethAI::InitializeAI(), boss_prince_taldaram_icc::boss_prince_taldaramAI::InitializeAI(), boss_prince_valanar_icc::boss_prince_valanarAI::InitializeAI(), npc_icc_nerubar_broodkeeper::npc_icc_nerubar_broodkeeperAI::InitializeAI(), npc_lord_arete::npc_lord_areteAI::InitializeAI(), npc_time_lost_proto_drake::npc_time_lost_proto_drakeAI::InitializeAI(), boss_ambassador_hellmaw::InitializeAI(), npc_millhouse_manastorm::npc_millhouse_manastormAI::InitializeAI(), Player::InitStatsForLevel(), boss_falric::boss_falricAI::JustEngagedWith(), boss_marwyn::boss_marwynAI::JustEngagedWith(), boss_moroes::JustEngagedWith(), npc_highlord_darion_mograine::npc_highlord_darion_mograineAI::JustRespawned(), npc_rinji::npc_rinjiAI::JustRespawned(), npc_isla_starmane::npc_isla_starmaneAI::JustRespawned(), npc_highlord_darion_mograine::npc_highlord_darion_mograineAI::JustSummoned(), boss_skeram::JustSummoned(), boss_majordomo::boss_majordomoAI::JustSummoned(), boss_captain_skarloc::JustSummoned(), npc_tirions_gambit_tirion::npc_tirions_gambit_tirionAI::JustSummoned(), npc_dkc1_gothik::npc_dkc1_gothikAI::MoveInLineOfSight(), boss_nalorakk::MoveInLineOfSight(), boss_captain_skarloc::MovementInform(), boss_taldaram::MovementInform(), boss_grand_champion::boss_grand_championAI::MovementInform(), boss_sister_svalna::boss_sister_svalnaAI::MovementInform(), npc_icc_nerubar_broodkeeper::npc_icc_nerubar_broodkeeperAI::MovementInform(), boss_jedoga_shadowseeker::MovementInform(), npc_memory::npc_memoryAI::npc_memoryAI(), npc_rinji::npc_rinjiAI::npc_rinjiAI(), instance_zulaman::instance_zulaman_InstanceMapScript::OnCreatureCreate(), npc_blackhand_incarcerator::npc_blackhand_incarceratorAI::Reset(), boss_rend_blackhand::boss_rend_blackhandAI::Reset(), boss_ragnaros::boss_ragnarosAI::Reset(), boss_mandokir::boss_mandokirAI::Reset(), boss_skeram::Reset(), boss_jedoga_shadowseeker::Reset(), boss_black_knight::boss_black_knightAI::Reset(), npc_black_knight_skeletal_gryphon::npc_black_knight_skeletal_gryphonAI::Reset(), boss_grand_champion::boss_grand_championAI::Reset(), boss_falric::boss_falricAI::Reset(), boss_marwyn::boss_marwynAI::Reset(), boss_deathbringer_saurfang::boss_deathbringer_saurfangAI::Reset(), boss_sister_svalna::boss_sister_svalnaAI::Reset(), boss_svala::boss_svalaAI::Reset(), boss_ambassador_hellmaw::Reset(), boss_broggok::Reset(), boss_grand_warlock_nethekurse::Reset(), npc_warden_mellichar::npc_warden_mellicharAI::Reset(), instance_blood_furnace::instance_blood_furnace_InstanceMapScript::ResetPrisoner(), boss_svala::boss_svalaAI::SetData(), npc_blackhand_incarcerator::npc_blackhand_incarceratorAI::SetData(), boss_chromaggus::boss_chromaggusAI::SetGUID(), boss_black_knight::boss_black_knightAI::SpellHitTarget(), npc_rinji::npc_rinjiAI::sQuestAccept(), boss_majordomo::boss_majordomoAI::SummonedCreatureDies(), boss_jedoga_shadowseeker::SummonedCreatureDies(), boss_ragnaros::boss_ragnarosAI::UpdateAI(), npc_highlord_darion_mograine::npc_highlord_darion_mograineAI::UpdateAI(), boss_kirtonos_the_herald::boss_kirtonos_the_heraldAI::UpdateAI(), npc_varian_wrynn::npc_varian_wrynnAI::UpdateAI(), npc_thrall_bfu::npc_thrall_bfuAI::UpdateAI(), boss_mandokir::boss_mandokirAI::UpdateAI(), npc_arthas::npc_arthasAI::UpdateAI(), npc_thrall_old_hillsbrad::npc_thrall_old_hillsbradAI::UpdateAI(), boss_skeram::UpdateAI(), npc_memory::npc_memoryAI::UpdateAI(), boss_grand_champion::boss_grand_championAI::UpdateAI(), boss_krick::boss_krickAI::UpdateAI(), npc_crok_scourgebane::npc_crok_scourgebaneAI::UpdateAI(), boss_svala::boss_svalaAI::UpdateAI(), boss_anzu::UpdateAI(), npc_millhouse_manastorm::npc_millhouse_manastormAI::UpdateAI(), npc_artorius::npc_artoriusAI::UpdateAI(), npc_simone::npc_simoneAI::UpdateAI(), npc_nelson::npc_nelsonAI::UpdateAI(), and npc_franklin::npc_franklinAI::UpdateAI().

◆ SetImmuneToNPC()

◆ SetImmuneToPC()

void Unit::SetImmuneToPC ( bool  apply,
bool  keepCombat = false 
)
10535{
10536 (void)keepCombat;
10537 if (apply)
10539 else
10541}

References RemoveUnitFlag(), SetUnitFlag(), and UNIT_FLAG_IMMUNE_TO_PC.

Referenced by boss_victor_nefarius::boss_victor_nefariusAI::BeginEvent(), boss_the_lich_king::boss_the_lich_kingAI::boss_the_lich_kingAI(), ClearInCombat(), npc_overlord_drakuru_betrayal::DamageTaken(), npc_magister_aledis::DamageTaken(), boss_dorothee::DoAction(), boss_roar::DoAction(), boss_strawman::DoAction(), boss_tinhead::DoAction(), boss_apothecary_hummel::boss_apothecary_hummelAI::DoAction(), npc_apothecary_genericAI::DoAction(), npc_coren_direbrew::DoAction(), npc_direbrew_antagonist::DoAction(), npc_spinestalker::npc_spinestalkerAI::DoAction(), npc_rimefang::npc_rimefangAI::DoAction(), boss_algalon_the_observer::DoAction(), npc_frozen_core::DoAction(), boss_tenris_mirkblood::EnterEvadeMode(), spell_q11396_11399_force_shield_arcane_purple_x3::HandleEffectApply(), spell_q11396_11399_force_shield_arcane_purple_x3::HandleEffectRemove(), spell_chapter2_persuasive_strike::HandleHit(), boss_felmyst::InitializeAI(), boss_blackheart_the_inciter::JustEngagedWith(), npc_spinestalker::npc_spinestalkerAI::MovementInform(), npc_rimefang::npc_rimefangAI::MovementInform(), npc_omen::npc_omenAI::MovementInform(), npc_omen::npc_omenAI::npc_omenAI(), instance_ulduar::instance_ulduar_InstanceMapScript::OnPlayerEnter(), npc_kaya_flathoof::OnQuestAccept(), boss_doomrel::boss_doomrelAI::Reset(), boss_pyroguard_emberseer::boss_pyroguard_emberseerAI::Reset(), boss_tenris_mirkblood::Reset(), boss_julianne::Reset(), npc_unworthy_initiate::npc_unworthy_initiateAI::Reset(), npc_a_special_surprise::npc_a_special_surpriseAI::Reset(), npc_coren_direbrew::Reset(), boss_general_zarithrian::boss_general_zarithrianAI::Reset(), boss_the_lich_king::boss_the_lich_kingAI::Reset(), boss_gothik::boss_gothikAI::Reset(), boss_algalon_the_observer::Reset(), npc_venture_co_straggler::npc_venture_co_stragglerAI::Reset(), npc_wild_wyrm::Reset(), npc_overlord_drakuru_betrayal::Reset(), boss_blackheart_the_inciter::Reset(), boss_magtheridon::Reset(), npc_magister_aledis::Reset(), boss_magtheridon::ScheduleCombatEvents(), SetImmuneToAll(), SetInCombatState(), boss_victor_nefarius::boss_victor_nefariusAI::sGossipSelect(), npc_infernal_attacker::npc_infernal_attackerAI::SpellHit(), npc_overlord_drakuru_betrayal::SpellHit(), npc_venture_co_straggler::npc_venture_co_stragglerAI::SpellHit(), npc_wild_wyrm::SpellHit(), boss_felmyst::StartIntro(), boss_pyroguard_emberseer::boss_pyroguard_emberseerAI::UpdateAI(), go_blood_drenched_door::go_blood_drenched_doorAI::UpdateAI(), npc_unworthy_initiate::npc_unworthy_initiateAI::UpdateAI(), npc_a_special_surprise::npc_a_special_surpriseAI::UpdateAI(), boss_gothik::boss_gothikAI::UpdateAI(), boss_algalon_the_observer::UpdateAI(), npc_overlord_drakuru_betrayal::UpdateAI(), and npc_magister_aledis::UpdateAI().

◆ SetInCombatState()

void Unit::SetInCombatState ( bool  PvP,
Unit enemy = nullptr,
uint32  duration = 0 
)
10666{
10667 // only alive units can be in combat
10668 if (!IsAlive())
10669 return;
10670
10671 if (PvP)
10672 m_CombatTimer = std::max<uint32>(GetCombatTimer(), std::max<uint32>(5500, duration));
10673 else if (duration)
10674 m_CombatTimer = std::max<uint32>(GetCombatTimer(), duration);
10675
10677 return;
10678
10679 // xinef: if we somehow engage in combat (scripts, dunno) with player, remove this flag so he can fight back
10680 if (IsCreature() && enemy && IsImmuneToPC() && enemy->GetCharmerOrOwnerPlayerOrPlayerItself())
10681 SetImmuneToPC(false); // unit has engaged in combat, remove immunity so players can fight back
10682
10683 if (IsInCombat())
10684 return;
10685
10687
10688 if (Creature* creature = ToCreature())
10689 {
10690 // Set home position at place of engaging combat for escorted creatures
10691 if ((IsAIEnabled && creature->AI()->IsEscorted()) ||
10692 GetMotionMaster()->GetCurrentMovementGeneratorType() == WAYPOINT_MOTION_TYPE ||
10693 GetMotionMaster()->GetCurrentMovementGeneratorType() == ESCORT_MOTION_TYPE)
10694 creature->SetHomePosition(GetPositionX(), GetPositionY(), GetPositionZ(), GetOrientation());
10695
10696 if (enemy)
10697 {
10698 creature->UpdateLeashExtensionTime();
10699
10700 if (IsAIEnabled)
10701 creature->AI()->JustEngagedWith(enemy);
10702
10703 if (creature->GetFormation())
10704 creature->GetFormation()->MemberEngagingTarget(creature, enemy);
10705
10706 sScriptMgr->OnUnitEnterCombat(creature, enemy);
10707 }
10708
10709 creature->RefreshSwimmingFlag();
10710
10711 if (IsPet())
10712 {
10713 UpdateSpeed(MOVE_RUN, true);
10714 UpdateSpeed(MOVE_SWIM, true);
10715 UpdateSpeed(MOVE_FLIGHT, true);
10716 }
10717
10718 if (!(creature->GetCreatureTemplate()->type_flags & CREATURE_TYPE_FLAG_ALLOW_MOUNTED_COMBAT))
10719 Dismount();
10720 if (!IsStandState()) // pussywizard: already done in CombatStart(target, initialAggro) for the target, but when aggro'ing from MoveInLOS CombatStart is not called!
10722 }
10723
10724 for (Unit::ControlSet::iterator itr = m_Controlled.begin(); itr != m_Controlled.end();)
10725 {
10726 Unit* controlled = *itr;
10727 ++itr;
10728
10729 // Xinef: Dont set combat for passive units, they will evade in next update...
10730 if (controlled->IsCreature() && controlled->ToCreature()->HasReactState(REACT_PASSIVE))
10731 continue;
10732
10733 controlled->SetInCombatState(PvP, enemy, duration);
10734 }
10735
10736 if (Player* player = this->ToPlayer())
10737 {
10738 sScriptMgr->OnPlayerEnterCombat(player, enemy);
10739 }
10740}
@ ESCORT_MOTION_TYPE
Definition MotionMaster.h:57
@ WAYPOINT_MOTION_TYPE
Definition MotionMaster.h:41
@ CREATURE_TYPE_NON_COMBAT_PET
Definition SharedDefines.h:2640
@ CREATURE_TYPE_FLAG_ALLOW_MOUNTED_COMBAT
Definition SharedDefines.h:2707
@ MOVE_FLIGHT
Definition UnitDefines.h:359
@ MOVE_SWIM
Definition UnitDefines.h:356
bool HasReactState(ReactStates state) const
Definition Creature.h:101
uint32 GetCombatTimer() const
Definition Unit.h:938
void SetInCombatState(bool PvP, Unit *enemy=nullptr, uint32 duration=0)
Definition Unit.cpp:10665
bool IsStandState() const
Definition Unit.cpp:13213

References CREATURE_TYPE_FLAG_ALLOW_MOUNTED_COMBAT, CREATURE_TYPE_NON_COMBAT_PET, Dismount(), ESCORT_MOTION_TYPE, GetCharmerOrOwnerPlayerOrPlayerItself(), GetCombatTimer(), GetCreatureType(), GetMotionMaster(), Position::GetOrientation(), Position::GetPositionX(), Position::GetPositionY(), Position::GetPositionZ(), Creature::HasReactState(), HasUnitState(), IsAIEnabled, IsAlive(), Object::IsCreature(), IsImmuneToPC(), IsInCombat(), IsPet(), IsStandState(), m_CombatTimer, m_Controlled, MOVE_FLIGHT, MOVE_RUN, MOVE_SWIM, REACT_PASSIVE, SetImmuneToPC(), SetInCombatState(), SetStandState(), SetUnitFlag(), sScriptMgr, Object::ToCreature(), Object::ToPlayer(), UNIT_FLAG_IN_COMBAT, UNIT_STAND_STATE_STAND, UNIT_STATE_EVADE, UpdateSpeed(), and WAYPOINT_MOTION_TYPE.

Referenced by Spell::DoSpellHitOnUnit(), SetInCombatState(), and SetInCombatWith().

◆ SetInCombatWith()

void Unit::SetInCombatWith ( Unit enemy,
uint32  duration = 0 
)
10508{
10509 // Xinef: Dont allow to start combat with triggers
10510 if (enemy->IsCreature() && enemy->ToCreature()->IsTrigger())
10511 return;
10512
10513 Unit* eOwner = enemy->GetCharmerOrOwnerOrSelf();
10514 if (eOwner->IsPvP() || eOwner->IsFFAPvP())
10515 {
10516 SetInCombatState(true, enemy, duration);
10517 return;
10518 }
10519
10520 // check for duel
10521 if (eOwner->IsPlayer() && eOwner->ToPlayer()->duel)
10522 {
10523 Unit const* myOwner = GetCharmerOrOwnerOrSelf();
10524 if (((Player const*)eOwner)->duel->Opponent == myOwner)
10525 {
10526 SetInCombatState(true, enemy, duration);
10527 return;
10528 }
10529 }
10530
10531 SetInCombatState(false, enemy, duration);
10532}

References Player::duel, GetCharmerOrOwnerOrSelf(), Object::IsCreature(), IsFFAPvP(), Object::IsPlayer(), IsPvP(), Creature::IsTrigger(), SetInCombatState(), Object::ToCreature(), and Object::ToPlayer().

Referenced by Attack(), npc_daphne_stilwell::npc_daphne_stilwellAI::AttackStart(), CombatStart(), CombatStartOnCast(), npc_centrifuge_construct::npc_centrifuge_constructAI::DamageTaken(), Spell::DoAllEffectOnTarget(), CreatureAI::DoZoneInCombat(), boss_sapphiron::boss_sapphironAI::EnterCombatSelfFunction(), spell_herald_volzaj_insanity::HandleDummyEffect(), boss_chromaggus::boss_chromaggusAI::PathEndReached(), SmartScript::ProcessAction(), npc_high_overlord_saurfang_igb::npc_high_overlord_saurfang_igbAI::UpdateAI(), npc_muradin_bronzebeard_igb::npc_muradin_bronzebeard_igbAI::UpdateAI(), npc_gunship_boarding_addAI::UpdateAI(), and npc_gunship_gunner::npc_gunship_gunnerAI::UpdateAI().

◆ SetInFront()

◆ SetInstantCast()

void Unit::SetInstantCast ( bool  set)
inline
1575{ _instantCast = set; }

References _instantCast.

Referenced by AuraEffect::HandleModCastingSpeed().

◆ SetLastDamagedTargetGuid()

void Unit::SetLastDamagedTargetGuid ( ObjectGuid const &  guid)
inline

◆ SetLastExtraAttackSpell()

void Unit::SetLastExtraAttackSpell ( uint32  spellId)
inline
998{ _lastExtraAttackSpell = spellId; }

References _lastExtraAttackSpell.

Referenced by Spell::_handle_finish_phase().

◆ SetLastManaUse()

void Unit::SetLastManaUse ( uint32  spellCastTime)
inline
1140{ m_lastManaUse = spellCastTime; }

References m_lastManaUse.

Referenced by Spell::TakePower().

◆ SetLevel()

void Unit::SetLevel ( uint8  lvl,
bool  showLevelChange = true 
)

◆ SetMaxHealth()

void Unit::SetMaxHealth ( uint32  val)
12539{
12540 if (!val)
12541 val = 1;
12542
12543 uint32 health = GetHealth();
12545
12546 // group update
12547 if (IsPlayer())
12548 {
12549 Player* player = ToPlayer();
12550 if (player->NeedSendSpectatorData())
12552
12553 if (player->GetGroup())
12555 }
12556 else if (Pet* pet = ToCreature()->ToPet())
12557 {
12558 if (pet->isControlled())
12559 {
12560 if (Unit* owner = GetOwner())
12561 if (Player* player = owner->ToPlayer())
12562 {
12563 if (player->NeedSendSpectatorData() && pet->GetCreatureTemplate()->family)
12564 ArenaSpectator::SendCommand_UInt32Value(player->FindMap(), player->GetGUID(), "PHP", (uint32)pet->GetHealthPct());
12565
12566 if (player->GetGroup())
12568 }
12569 }
12570 }
12571
12572 if (val < health)
12573 SetHealth(val);
12574}
@ GROUP_UPDATE_FLAG_MAX_HP
Definition Group.h:102
@ GROUP_UPDATE_FLAG_PET_MAX_HP
Definition Group.h:114

References WorldObject::FindMap(), Player::GetGroup(), Object::GetGUID(), GetHealth(), GetOwner(), GROUP_UPDATE_FLAG_MAX_HP, GROUP_UPDATE_FLAG_PET_MAX_HP, Object::IsPlayer(), Player::NeedSendSpectatorData(), ArenaSpectator::SendCommand_UInt32Value(), Player::SetGroupUpdateFlag(), SetHealth(), SetUInt32Value(), Object::ToCreature(), ToPet(), Object::ToPlayer(), and UNIT_FIELD_MAXHEALTH.

Referenced by boss_xt002::DoAction(), Spell::EffectSummonType(), modify_commandscript::HandleModifyHPCommand(), npc_commandscript::HandleNpcSetLevelCommand(), npc_pet_pri_lightwell::InitializeAI(), Player::InitStatsForLevel(), boss_skeram::JustSummoned(), npc_corrupted_totem::npc_corrupted_totem(), npc_xt002_life_spark::npc_xt002_life_spark(), Creature::SelectLevel(), npc_pet_hunter_snake_trap::UpdateAI(), Creature::UpdateMaxHealth(), Guardian::UpdateMaxHealth(), and Player::UpdateMaxHealth().

◆ SetMaxPower()

void Unit::SetMaxPower ( Powers  power,
uint32  val 
)
12628{
12629 uint32 cur_power = GetPower(power);
12630 SetStatInt32Value(static_cast<uint16>(UNIT_FIELD_MAXPOWER1) + power, val);
12631
12632 // group update
12633 if (IsPlayer())
12634 {
12635 Player* player = ToPlayer();
12636 if (getPowerType() == power && player->NeedSendSpectatorData())
12637 ArenaSpectator::SendCommand_UInt32Value(FindMap(), GetGUID(), "MPW", power == POWER_RAGE || power == POWER_RUNIC_POWER ? val / 10 : val);
12638
12639 if (player->GetGroup())
12641 }
12642 else if (Pet* pet = ToCreature()->ToPet())
12643 {
12644 if (pet->isControlled())
12645 {
12646 Unit* owner = GetOwner();
12647 if (owner && (owner->IsPlayer()) && owner->ToPlayer()->GetGroup())
12649 }
12650 }
12651
12652 if (val < cur_power)
12653 SetPower(power, val);
12654}
@ GROUP_UPDATE_FLAG_PET_MAX_POWER
Definition Group.h:117
@ GROUP_UPDATE_FLAG_MAX_POWER
Definition Group.h:105
void SetStatInt32Value(uint16 index, int32 value)
Definition Object.cpp:787

References WorldObject::FindMap(), Player::GetGroup(), Object::GetGUID(), GetOwner(), GetPower(), getPowerType(), GROUP_UPDATE_FLAG_MAX_POWER, GROUP_UPDATE_FLAG_PET_MAX_POWER, Object::IsPlayer(), Player::NeedSendSpectatorData(), POWER_RAGE, POWER_RUNIC_POWER, ArenaSpectator::SendCommand_UInt32Value(), Player::SetGroupUpdateFlag(), SetPower(), Object::SetStatInt32Value(), Object::ToCreature(), ToPet(), Object::ToPlayer(), and UNIT_FIELD_MAXPOWER1.

Referenced by Player::Create(), Pet::CreateBaseAtTamed(), modify_commandscript::HandleModifyEnergyCommand(), modify_commandscript::HandleModifyManaCommand(), modify_commandscript::HandleModifyRageCommand(), modify_commandscript::HandleModifyRunicPowerCommand(), spell_putricide_mutated_transformation::HandleSummon(), Player::InitStatsForLevel(), Pet::LoadPetFromDB(), Creature::SelectLevel(), setPowerType(), Creature::UpdateMaxPower(), Guardian::UpdateMaxPower(), and Player::UpdateMaxPower().

◆ SetMinion()

void Unit::SetMinion ( Minion minion,
bool  apply 
)
7675{
7676 LOG_DEBUG("entities.unit", "SetMinion {} for {}, apply {}", minion->GetEntry(), GetEntry(), apply);
7677
7678 if (apply)
7679 {
7680 if (minion->GetOwnerGUID())
7681 {
7682 LOG_FATAL("entities.unit", "SetMinion: Minion {} is not the minion of owner {}", minion->GetEntry(), GetEntry());
7683 return;
7684 }
7685
7686 minion->SetOwnerGUID(GetGUID());
7687
7688 m_Controlled.insert(minion);
7689
7690 if (IsPlayer())
7691 {
7692 minion->m_ControlledByPlayer = true;
7694 }
7695
7696 // Can only have one pet. If a new one is summoned, dismiss the old one.
7697 if (minion->IsGuardianPet())
7698 {
7699 if (Guardian* oldPet = GetGuardianPet())
7700 {
7701 if (oldPet != minion && (oldPet->IsPet() || minion->IsPet() || oldPet->GetEntry() != minion->GetEntry()))
7702 {
7703 // remove existing minion pet
7704 if (Pet* oldPetAsPet = oldPet->ToPet())
7705 {
7706 oldPetAsPet->Remove(PET_SAVE_NOT_IN_SLOT);
7707 }
7708 else
7709 {
7710 oldPet->UnSummon();
7711 }
7712
7713 SetPetGUID(minion->GetGUID());
7715 }
7716 }
7717 else
7718 {
7719 SetPetGUID(minion->GetGUID());
7721 }
7722 }
7723
7725 {
7727 }
7728
7729 if (minion->m_Properties && minion->m_Properties->Type == SUMMON_TYPE_MINIPET)
7730 {
7731 SetCritterGUID(minion->GetGUID());
7732 }
7733
7734 // PvP, FFAPvP
7736
7737 // Ghoul pets have energy instead of mana (is anywhere better place for this code?)
7738 if (minion->IsPetGhoul() || minion->GetEntry() == 24207 /*ENTRY_ARMY_OF_THE_DEAD*/)
7739 minion->setPowerType(POWER_ENERGY);
7740
7741 if (IsPlayer())
7742 {
7743 // Send infinity cooldown - client does that automatically but after relog cooldown needs to be set again
7744 SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(minion->GetUInt32Value(UNIT_CREATED_BY_SPELL));
7745
7746 if (spellInfo && spellInfo->IsCooldownStartedOnEvent())
7747 ToPlayer()->AddSpellAndCategoryCooldowns(spellInfo, 0, nullptr, true);
7748 }
7749 }
7750 else
7751 {
7752 if (minion->GetOwnerGUID() != GetGUID())
7753 {
7754 LOG_FATAL("entities.unit", "SetMinion: Minion {} is not the minion of owner {}", minion->GetEntry(), GetEntry());
7755 return;
7756 }
7757
7758 m_Controlled.erase(minion);
7759
7760 if (minion->m_Properties && minion->m_Properties->Type == SUMMON_TYPE_MINIPET)
7761 {
7762 if (GetCritterGUID() == minion->GetGUID())
7764 }
7765
7766 if (minion->IsGuardianPet())
7767 {
7768 if (GetPetGUID() == minion->GetGUID())
7770 }
7771 else if (minion->IsTotem())
7772 {
7773 // All summoned by totem minions must disappear when it is removed.
7774 if (SpellInfo const* spInfo = sSpellMgr->GetSpellInfo(minion->ToTotem()->GetSpell()))
7775 {
7776 for (int i = 0; i < MAX_SPELL_EFFECTS; ++i)
7777 {
7778 if (spInfo->Effects[i].Effect != SPELL_EFFECT_SUMMON)
7779 continue;
7780
7781 RemoveAllMinionsByEntry(spInfo->Effects[i].MiscValue);
7782 }
7783 }
7784 }
7785
7786 if (IsPlayer())
7787 {
7788 SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(minion->GetUInt32Value(UNIT_CREATED_BY_SPELL));
7789 // Remove infinity cooldown
7790 if (spellInfo && spellInfo->IsCooldownStartedOnEvent())
7791 ToPlayer()->SendCooldownEvent(spellInfo);
7792
7793 // xinef: clear spell book
7794 if (m_Controlled.empty())
7796 }
7797
7798 //if (minion->HasUnitTypeMask(UNIT_MASK_GUARDIAN))
7799 {
7801 {
7802 // Check if there is another minion
7803 for (ControlSet::iterator itr = m_Controlled.begin(); itr != m_Controlled.end(); ++itr)
7804 {
7805 // do not use this check, creature do not have charm guid
7806 //if (GetCharmGUID() == (*itr)->GetGUID())
7807 if (GetGUID() == (*itr)->GetCharmerGUID())
7808 continue;
7809
7810 //ASSERT((*itr)->GetOwnerGUID() == GetGUID());
7811 if ((*itr)->GetOwnerGUID() != GetGUID())
7812 {
7813 OutDebugInfo();
7814 (*itr)->OutDebugInfo();
7815 ABORT();
7816 }
7817 ASSERT((*itr)->IsCreature());
7818
7819 if (!(*itr)->HasUnitTypeMask(UNIT_MASK_CONTROLLABLE_GUARDIAN))
7820 continue;
7821
7822 if (AddGuidValue(UNIT_FIELD_SUMMON, (*itr)->GetGUID()))
7823 {
7824 // show another pet bar if there is no charm bar
7825 if (IsPlayer() && !GetCharmGUID())
7826 {
7827 if ((*itr)->IsPet())
7829 else
7831 }
7832 }
7833 break;
7834 }
7835 }
7836 }
7837 }
7838}
@ PET_SAVE_NOT_IN_SLOT
Definition PetDefines.h:46
@ SPELL_EFFECT_SUMMON
Definition SharedDefines.h:817
@ SUMMON_TYPE_MINIPET
Definition SharedDefines.h:3539
bool IsGuardianPet() const
Definition TemporarySummon.cpp:395
bool IsPetGhoul() const
Definition TemporarySummon.h:95
void PetSpellInitialize()
Definition Player.cpp:9499
const SummonPropertiesEntry *const m_Properties
Definition TemporarySummon.h:74
uint32 GetSpell(uint8 slot=0) const
Definition Totem.h:59
void OutDebugInfo() const
Definition Unit.cpp:16328
ObjectGuid GetCritterGUID() const
Definition Unit.h:719
void SetOwnerGUID(ObjectGuid owner)
Definition Unit.cpp:7562
void SetCritterGUID(ObjectGuid guid)
Definition Unit.h:718
void setPowerType(Powers power)
Definition Unit.cpp:6943
void RemoveAllMinionsByEntry(uint32 entry)
Definition Unit.cpp:7852
uint32 Type
Definition DBCStructure.h:1913

References ABORT, Object::AddGuidValue(), Player::AddSpellAndCategoryCooldowns(), ASSERT, Player::CharmSpellInitialize(), ObjectGuid::Empty, Object::GetByteValue(), GetCharmGUID(), GetCritterGUID(), Object::GetEntry(), GetGuardianPet(), Object::GetGUID(), Object::GetGUID(), GetOwnerGUID(), GetPetGUID(), Totem::GetSpell(), Object::GetUInt32Value(), HasUnitTypeMask(), SpellInfo::IsCooldownStartedOnEvent(), Minion::IsGuardianPet(), IsPet(), Minion::IsPetGhoul(), Object::IsPlayer(), IsTotem(), LOG_DEBUG, LOG_FATAL, m_Controlled, m_ControlledByPlayer, TempSummon::m_Properties, MAX_SPELL_EFFECTS, OutDebugInfo(), PET_SAVE_NOT_IN_SLOT, Player::PetSpellInitialize(), POWER_ENERGY, RemoveAllMinionsByEntry(), Object::RemoveGuidValue(), Player::SendCooldownEvent(), Player::SendRemoveControlBar(), Object::SetByteValue(), SetCritterGUID(), SetMinionGUID(), SetOwnerGUID(), SetPetGUID(), setPowerType(), SetUnitFlag(), SPELL_EFFECT_SUMMON, sSpellMgr, SUMMON_TYPE_MINIPET, ToPet(), Object::ToPlayer(), ToTotem(), SummonPropertiesEntry::Type, UNIT_CREATED_BY_SPELL, UNIT_FIELD_BYTES_2, UNIT_FIELD_SUMMON, UNIT_FLAG_PLAYER_CONTROLLED, and UNIT_MASK_CONTROLLABLE_GUARDIAN.

Referenced by Player::CreatePet(), Player::CreatePet(), Spell::EffectCreateTamedPet(), Spell::EffectTameCreature(), Pet::LoadPetFromDB(), Player::RemovePet(), and Player::SummonPet().

◆ SetMinionGUID()

void Unit::SetMinionGUID ( ObjectGuid  guid)
inline

◆ SetModelVisible()

◆ SetNativeDisplayId()

◆ SetNpcFlag()

void Unit::SetNpcFlag ( NPCFlags  flags)
inline
758{ SetFlag(UNIT_NPC_FLAGS, flags); }

References Object::SetFlag(), and UNIT_NPC_FLAGS.

Referenced by Vehicle::AddPassenger(), npc_riggle_bassbait::npc_riggle_bassbaitAI::CheckTournamentState(), npc_ulduar_arachnopod_destroyer::DamageTaken(), npc_magister_aledis::DamageTaken(), npc_thrall_warchief::npc_thrall_warchiefAI::DoAction(), boss_vaelastrasz::boss_vaelAI::Initialize(), boss_majordomo::boss_majordomoAI::InitializeAI(), npc_sergeant_bly::npc_sergeant_blyAI::InitializeAI(), npc_weegli_blastfuse::npc_weegli_blastfuseAI::InitializeAI(), npc_isle_of_conquest_turret::npc_isle_of_conquest_turretAI::JustDied(), npc_weegli_blastfuse::npc_weegli_blastfuseAI::JustReachedHome(), npc_tirion_fordring_tft::npc_tirion_fordringAI::JustReachedHome(), npc_battle_at_valhalas::npc_battle_at_valhalasAI::JustReachedHome(), npc_chesspiece::MovementInform(), npc_fos_leader_second::npc_fos_leader_secondAI::MovementInform(), npc_pos_leader_second::npc_pos_leader_secondAI::MovementInform(), npc_weegli_blastfuse::npc_weegli_blastfuseAI::MovementInform(), npc_oculus_drakegiver::npc_oculus_drakegiverAI::MovementInform(), npc_chesspiece::OnCharmed(), instance_halls_of_reflection::instance_halls_of_reflection_InstanceMapScript::OnCreatureCreate(), npc_akama_illidan::PathEndReached(), npc_chicken_cluck::npc_chicken_cluckAI::ReceiveEmote(), npc_plucky::npc_pluckyAI::ReceiveEmote(), Vehicle::RemovePassenger(), npc_thrall_old_hillsbrad::npc_thrall_old_hillsbradAI::ReorderInstance(), boss_victor_nefarius::boss_victor_nefariusAI::Reset(), boss_apothecary_hummel::boss_apothecary_hummelAI::Reset(), npc_deathstalker_fearleia::Reset(), npc_varian_wrynn::npc_varian_wrynnAI::Reset(), npc_thrall_bfu::npc_thrall_bfuAI::Reset(), boss_azuregos::boss_azuregosAI::Reset(), npc_hyjal_jaina::hyjalJainaAI::Reset(), npc_hyjal_thrall::hyjalThrallAI::Reset(), npc_thrall_old_hillsbrad::npc_thrall_old_hillsbradAI::Reset(), npc_belnistrasz::npc_belnistraszAI::Reset(), npc_high_overlord_saurfang_icc::npc_high_overlord_saurfangAI::Reset(), npc_muradin_bronzebeard_icc::npc_muradin_bronzebeard_iccAI::Reset(), npc_crusade_recruit::npc_crusade_recruitAI::Reset(), npc_akama_illidan::Reset(), npc_akama_shade::Reset(), npc_magister_aledis::Reset(), Vehicle::Reset(), npc_battle_at_valhalas::npc_battle_at_valhalasAI::ResetData(), NPCStaveQuestAI::ResetState(), boss_majordomo::boss_majordomoAI::SpellHit(), npc_aged_dying_ancient_kodo::SpellHit(), npc_thrall_bfu::npc_thrall_bfuAI::UpdateAI(), npc_arthas::npc_arthasAI::UpdateAI(), npc_thrall_old_hillsbrad::npc_thrall_old_hillsbradAI::UpdateAI(), npc_xerestrasza::npc_xerestraszaAI::UpdateAI(), npc_hor_leader::npc_hor_leaderAI::UpdateAI(), npc_hor_leader_second::npc_hor_leader_secondAI::UpdateAI(), npc_isle_of_conquest_turret::npc_isle_of_conquest_turretAI::UpdateAI(), npc_oculus_drakegiver::npc_oculus_drakegiverAI::UpdateAI(), npc_shandy_dalaran::npc_shandy_dalaranAI::UpdateAI(), npc_lake_frog::npc_lake_frogAI::UpdateAI(), npc_aeranas::npc_aeranasAI::UpdateAI(), Vehicle::Vehicle(), npc_arthas::npc_arthasAI::WaypointReached(), npc_daphne_stilwell::npc_daphne_stilwellAI::WaypointReached(), npc_thrall_old_hillsbrad::npc_thrall_old_hillsbradAI::WaypointReached(), npc_general_andorov::WaypointReached(), and npc_cork_gizelton::npc_cork_gizeltonAI::WaypointReached().

◆ SetOwnerGUID()

void Unit::SetOwnerGUID ( ObjectGuid  owner)
7563{
7564 if (GetOwnerGUID() == owner)
7565 return;
7566
7568 if (!owner)
7569 return;
7570
7571 m_applyResilience = !IsVehicle() && owner.IsPlayer();
7572
7573 // Update owner dependent fields
7574 Player* player = ObjectAccessor::GetPlayer(*this, owner);
7575 if (!player || !player->HaveAtClient(this)) // if player cannot see this unit yet, he will receive needed data with create object
7576 return;
7577
7579
7580 UpdateData udata;
7581 WorldPacket packet;
7582 BuildValuesUpdateBlockForPlayer(&udata, player);
7583 udata.BuildPacket(packet);
7584 player->SendDirectMessage(&packet);
7585
7587}
void BuildValuesUpdateBlockForPlayer(UpdateData *data, Player *target)
Definition Object.cpp:246
void RemoveFieldNotifyFlag(uint16 flag)
Definition Object.h:195
void SetFieldNotifyFlag(uint16 flag)
Definition Object.h:194
bool HaveAtClient(WorldObject const *u) const
Definition Player.cpp:11352
Definition UpdateData.h:52
bool BuildPacket(WorldPacket &packet)
Definition UpdateData.cpp:48

References UpdateData::BuildPacket(), Object::BuildValuesUpdateBlockForPlayer(), GetOwnerGUID(), ObjectAccessor::GetPlayer(), Player::HaveAtClient(), ObjectGuid::IsPlayer(), IsVehicle(), m_applyResilience, Object::RemoveFieldNotifyFlag(), Player::SendDirectMessage(), Object::SetFieldNotifyFlag(), Object::SetGuidValue(), UF_FLAG_OWNER, and UNIT_FIELD_SUMMONEDBY.

Referenced by GameObject::CastSpell(), Spell::EffectSummonType(), boss_illidari_council_memberAI::EnterEvadeMode(), spell_item_draenic_pale_ale::HandleSummon(), npc_pet_gen_fetch_ball::IsSummonedBy(), boss_razorgore::boss_razorgoreAI::JustSummoned(), Player::LoadFromDB(), SetMinion(), and npc_grimstone::npc_grimstoneAI::UpdateEscortAI().

◆ SetPetGUID()

◆ SetPhaseMask()

void Unit::SetPhaseMask ( uint32  newPhaseMask,
bool  update 
)
overridevirtual

Reimplemented from WorldObject.

15416{
15417 if (newPhaseMask == GetPhaseMask())
15418 return;
15419
15420 if (IsInWorld())
15421 {
15422 // xinef: to comment, bellow line should be removed
15423 // pussywizard: goign to other phase (valithria, algalon) should not remove such auras
15424 //RemoveNotOwnSingleTargetAuras(newPhaseMask, true); // we can lost access to caster or target
15425
15426 if (!sScriptMgr->CanSetPhaseMask(this, newPhaseMask, update))
15427 return;
15428
15429 // modify hostile references for new phasemask, some special cases deal with hostile references themselves
15430 if (IsCreature() || (!ToPlayer()->IsGameMaster() && !ToPlayer()->GetSession()->PlayerLogout()))
15431 {
15432 HostileRefMgr& refMgr = getHostileRefMgr();
15433 HostileReference* ref = refMgr.getFirst();
15434
15435 while (ref)
15436 {
15437 if (Unit* unit = ref->GetSource()->GetOwner())
15438 if (Creature* creature = unit->ToCreature())
15439 refMgr.setOnlineOfflineState(creature, creature->InSamePhase(newPhaseMask));
15440
15441 ref = ref->next();
15442 }
15443
15444 // modify threat lists for new phasemask
15445 if (!IsPlayer())
15446 {
15449
15450 // merge expects sorted lists
15451 threatList.sort();
15452 offlineThreatList.sort();
15453 threatList.merge(offlineThreatList);
15454
15455 for (ThreatContainer::StorageType::const_iterator itr = threatList.begin(); itr != threatList.end(); ++itr)
15456 if (Unit* unit = (*itr)->getTarget())
15457 unit->getHostileRefMgr().setOnlineOfflineState(ToCreature(), unit->InSamePhase(newPhaseMask));
15458 }
15459 }
15460 }
15461
15462 WorldObject::SetPhaseMask(newPhaseMask, false);
15463
15464 if (!IsInWorld())
15465 {
15466 return;
15467 }
15468
15469 for (ControlSet::const_iterator itr = m_Controlled.begin(); itr != m_Controlled.end(); )
15470 {
15471 Unit* controlled = *itr;
15472 ++itr;
15473 if (controlled->IsCreature())
15474 {
15475 controlled->SetPhaseMask(newPhaseMask, true);
15476 }
15477 }
15478
15479 for (uint8 i = 0; i < MAX_SUMMON_SLOT; ++i)
15480 {
15481 if (m_SummonSlot[i])
15482 {
15483 if (Creature* summon = GetMap()->GetCreature(m_SummonSlot[i]))
15484 {
15485 summon->SetPhaseMask(newPhaseMask, true);
15486 }
15487 }
15488 }
15489
15490 if (update)
15491 {
15493 }
15494}
Definition HostileRefMgr.h:31
void setOnlineOfflineState(bool isOnline)
Definition HostileRefMgr.cpp:98
HostileReference * getFirst()
Definition HostileRefMgr.h:59
HostileReference * next()
Definition ThreatMgr.h:115
FROM * GetSource() const
Definition Reference.h:97
ThreatContainer::StorageType const & GetOfflineThreatList() const
Definition ThreatMgr.h:278
Unit * GetOwner() const
Definition ThreatMgr.h:240
void SetPhaseMask(uint32 newPhaseMask, bool update) override
Definition Unit.cpp:15415
virtual void SetPhaseMask(uint32 newPhaseMask, bool update)
Definition Object.cpp:2910

References Map::GetCreature(), HostileRefMgr::getFirst(), getHostileRefMgr(), WorldObject::GetMap(), ThreatMgr::GetOfflineThreatList(), ThreatMgr::GetOwner(), WorldObject::GetPhaseMask(), Reference< TO, FROM >::GetSource(), ThreatMgr::GetThreatList(), GetThreatMgr(), WorldObject::InSamePhase(), Object::IsCreature(), Object::IsInWorld(), Object::IsPlayer(), m_Controlled, m_SummonSlot, MAX_SUMMON_SLOT, HostileReference::next(), HostileRefMgr::setOnlineOfflineState(), WorldObject::SetPhaseMask(), SetPhaseMask(), sScriptMgr, Object::ToCreature(), Object::ToPlayer(), and UpdateObjectVisibility().

Referenced by Pet::Create(), Creature::Create(), misc_commandscript::HandleAppearCommand(), modify_commandscript::HandleModifyPhaseCommand(), npc_commandscript::HandleNpcSetPhaseCommand(), spell_wintergrasp_hide_small_elementals_aura::HandlePeriodicDummy(), AuraEffect::HandlePhase(), Battlefield::HideNpc(), boss_zuramat::boss_zuramatAI::JustSummoned(), npc_the_lich_king_controller::npc_the_lich_king_controllerAI::JustSummoned(), boss_victor_nefarius::boss_victor_nefariusAI::Reset(), boss_volazj::Reset(), boss_twilight_halion::boss_twilight_halionAI::Reset(), Creature::setDeathState(), Player::SetGameMaster(), SetPhaseMask(), Battlefield::ShowNpc(), WorldObject::SummonTrigger(), and npc_mootoo_the_younger::npc_mootoo_the_youngerAI::WaypointReached().

◆ SetPower()

void Unit::SetPower ( Powers  power,
uint32  val,
bool  withPowerUpdate = true,
bool  fromRegenerate = false 
)
12577{
12578 if (!fromRegenerate && GetPower(power) == val)
12579 return;
12580
12581 uint32 maxPower = GetMaxPower(power);
12582 if (maxPower < val)
12583 val = maxPower;
12584
12585 if (fromRegenerate)
12586 {
12589 }
12590 else
12592
12593 if (withPowerUpdate)
12594 {
12595 WorldPacket data(SMSG_POWER_UPDATE, 8 + 1 + 4);
12596 data << GetPackGUID();
12597 data << uint8(power);
12598 data << uint32(val);
12599 SendMessageToSet(&data, IsPlayer());
12600 }
12601
12602 // group update
12603 if (IsPlayer())
12604 {
12605 Player* player = ToPlayer();
12606 if (getPowerType() == power && player->NeedSendSpectatorData())
12607 ArenaSpectator::SendCommand_UInt32Value(FindMap(), GetGUID(), "CPW", power == POWER_RAGE || power == POWER_RUNIC_POWER ? val / 10 : val);
12608
12609 if (player->GetGroup())
12611 }
12612 else if (Pet* pet = ToCreature()->ToPet())
12613 {
12614 if (pet->isControlled())
12615 {
12616 Unit* owner = GetOwner();
12617 if (owner && (owner->IsPlayer()) && owner->ToPlayer()->GetGroup())
12619 }
12620
12621 // Update the pet's character sheet with happiness damage bonus
12622 if (pet->getPetType() == HUNTER_PET && power == POWER_HAPPINESS)
12623 pet->UpdateDamagePhysical(BASE_ATTACK);
12624 }
12625}
@ GROUP_UPDATE_FLAG_PET_CUR_POWER
Definition Group.h:116
@ GROUP_UPDATE_FLAG_CUR_POWER
Definition Group.h:104
void UpdateUInt32Value(uint16 index, uint32 value)
Definition Object.cpp:652
void AddToObjectUpdateIfNeeded()
Definition Object.cpp:513
@ SMSG_POWER_UPDATE
Definition Opcodes.h:1182

References Object::AddToObjectUpdateIfNeeded(), AsUnderlyingType(), BASE_ATTACK, WorldObject::FindMap(), Player::GetGroup(), Object::GetGUID(), GetMaxPower(), GetOwner(), Object::GetPackGUID(), GetPower(), getPowerType(), GROUP_UPDATE_FLAG_CUR_POWER, GROUP_UPDATE_FLAG_PET_CUR_POWER, HUNTER_PET, Object::IsPlayer(), Player::NeedSendSpectatorData(), POWER_HAPPINESS, POWER_RAGE, POWER_RUNIC_POWER, ArenaSpectator::SendCommand_UInt32Value(), WorldObject::SendMessageToSet(), Player::SetGroupUpdateFlag(), Object::SetStatInt32Value(), SMSG_POWER_UPDATE, Object::ToCreature(), ToPet(), Object::ToPlayer(), UNIT_FIELD_POWER1, and Object::UpdateUInt32Value().

Referenced by Player::ActivateSpec(), Player::Create(), Pet::CreateBaseAtTamed(), boss_lady_deathwhisper::boss_lady_deathwhisperAI::DamageTaken(), boss_shade_of_aran::DamageTaken(), boss_deathbringer_saurfang::boss_deathbringer_saurfangAI::DoAction(), Spell::EffectSelfResurrect(), Spell::EffectSummonPet(), Player::GiveLevel(), AuraEffect::HandleAuraModShapeshift(), spell_warr_execute::HandleEffect(), modify_commandscript::HandleModifyEnergyCommand(), modify_commandscript::HandleModifyManaCommand(), modify_commandscript::HandleModifyRageCommand(), modify_commandscript::HandleModifyRunicPowerCommand(), spell_dk_pet_scaling::HandlePeriodic(), spell_dru_frenzied_regeneration::HandlePeriodic(), spell_hun_generic_scaling::HandlePeriodic(), spell_mage_pet_scaling::HandlePeriodic(), spell_sha_feral_spirit_scaling::HandlePeriodic(), spell_warl_generic_scaling::HandlePeriodic(), WorldSession::HandlePetAbandon(), spell_putricide_mutated_transformation::HandleSummon(), Player::InitStatsForLevel(), Guardian::InitStatsForLevel(), Creature::LoadCreatureFromDB(), Player::LoadFromDB(), Pet::LoadPetFromDB(), ModifyPower(), boss_shade_of_aran::OnPowerUpdate(), Player::ProcessDelayedOperations(), Player::Regenerate(), spell_igb_incinerating_blast::RemoveEnergy(), spell_igb_below_zero::RemovePassengers(), boss_curator::Reset(), boss_shade_of_aran::Reset(), boss_selin_fireheart::Reset(), boss_moam::Reset(), npc_obsidian_destroyer::Reset(), npc_obsidian_eradicator::Reset(), npc_obsidian_nullifier::Reset(), boss_deathbringer_saurfang::boss_deathbringer_saurfangAI::Reset(), boss_lady_deathwhisper::boss_lady_deathwhisperAI::Reset(), Player::ResetAllPowers(), Player::RestoreManaAfterDuel(), Player::ResurectUsingRequestData(), Player::ResurrectPlayer(), Creature::SelectLevel(), setDeathState(), SetMaxPower(), setPowerType(), Player::SummonPet(), and npc_dalaran_mage::npc_dalaran_mageAI::UpdateAI().

◆ setPowerType()

void Unit::setPowerType ( Powers  power)
6944{
6945 SetByteValue(UNIT_FIELD_BYTES_0, 3, new_powertype);
6946
6947 if (IsPlayer())
6948 {
6949 if (ToPlayer()->GetGroup())
6951 }
6952 else if (Pet* pet = ToCreature()->ToPet())
6953 {
6954 if (pet->isControlled())
6955 {
6956 Unit* owner = GetOwner();
6957 if (owner && (owner->IsPlayer()) && owner->ToPlayer()->GetGroup())
6959 }
6960 }
6961
6962 float powerMultiplier = 1.0f;
6963 if (!IsPet())
6964 if (Creature* creature = ToCreature())
6965 powerMultiplier = creature->GetCreatureTemplate()->ModMana;
6966
6967 switch (new_powertype)
6968 {
6969 default:
6970 case POWER_MANA:
6971 break;
6972 case POWER_RAGE:
6973 SetMaxPower(POWER_RAGE, uint32(std::ceil(GetCreatePowers(POWER_RAGE) * powerMultiplier)));
6974 SetPower(POWER_RAGE, 0);
6975 break;
6976 case POWER_FOCUS:
6977 SetMaxPower(POWER_FOCUS, uint32(std::ceil(GetCreatePowers(POWER_FOCUS) * powerMultiplier)));
6978 SetPower(POWER_FOCUS, uint32(std::ceil(GetCreatePowers(POWER_FOCUS) * powerMultiplier)));
6979 break;
6980 case POWER_ENERGY:
6981 SetMaxPower(POWER_ENERGY, uint32(std::ceil(GetCreatePowers(POWER_ENERGY) * powerMultiplier)));
6982 break;
6983 case POWER_HAPPINESS:
6984 SetMaxPower(POWER_HAPPINESS, uint32(std::ceil(GetCreatePowers(POWER_HAPPINESS) * powerMultiplier)));
6985 SetPower(POWER_HAPPINESS, uint32(std::ceil(GetCreatePowers(POWER_HAPPINESS) * powerMultiplier)));
6986 break;
6987 }
6988
6989 if (Player const* player = ToPlayer())
6990 if (player->NeedSendSpectatorData())
6991 {
6992 ArenaSpectator::SendCommand_UInt32Value(FindMap(), GetGUID(), "PWT", new_powertype);
6993 ArenaSpectator::SendCommand_UInt32Value(FindMap(), GetGUID(), "MPW", new_powertype == POWER_RAGE || new_powertype == POWER_RUNIC_POWER ? GetMaxPower(new_powertype) / 10 : GetMaxPower(new_powertype));
6994 ArenaSpectator::SendCommand_UInt32Value(FindMap(), GetGUID(), "CPW", new_powertype == POWER_RAGE || new_powertype == POWER_RUNIC_POWER ? GetPower(new_powertype) / 10 : GetPower(new_powertype));
6995 }
6996}
@ GROUP_UPDATE_FLAG_POWER_TYPE
Definition Group.h:103
@ GROUP_UPDATE_FLAG_PET_POWER_TYPE
Definition Group.h:115
uint32 GetCreatePowers(Powers power) const
Definition Unit.cpp:12656
void SetMaxPower(Powers power, uint32 val)
Definition Unit.cpp:12627

References WorldObject::FindMap(), GetCreatePowers(), Player::GetGroup(), Object::GetGUID(), GetMaxPower(), GetOwner(), GetPower(), GROUP_UPDATE_FLAG_PET_POWER_TYPE, GROUP_UPDATE_FLAG_POWER_TYPE, IsPet(), Object::IsPlayer(), POWER_ENERGY, POWER_FOCUS, POWER_HAPPINESS, POWER_MANA, POWER_RAGE, POWER_RUNIC_POWER, ArenaSpectator::SendCommand_UInt32Value(), Object::SetByteValue(), Player::SetGroupUpdateFlag(), SetMaxPower(), SetPower(), Object::ToCreature(), ToPet(), Object::ToPlayer(), and UNIT_FIELD_BYTES_0.

Referenced by Pet::CreateBaseAtTamed(), AuraEffect::HandleAuraModShapeshift(), spell_putricide_mutated_transformation::HandleSummon(), Player::InitDataForForm(), Vehicle::Install(), Pet::LoadPetFromDB(), npc_toc_rogue::npc_toc_rogueAI::npc_toc_rogueAI(), SetMinion(), and Player::SummonPet().

◆ SetPvP()

◆ setRace()

void Unit::setRace ( uint8  race)
17231{
17232 if (IsPlayer())
17233 m_race = race;
17234}

References Object::IsPlayer(), and m_race.

◆ SetRedirectThreat()

void Unit::SetRedirectThreat ( ObjectGuid  guid,
uint32  pct 
)
inline
954{ _redirectThreatInfo.Set(guid, pct); }
void Set(ObjectGuid guid, uint32 pct)
Definition ThreatMgr.h:305

References _redirectThreatInfo, and RedirectThreatInfo::Set().

Referenced by Spell::EffectRedirectThreat(), and ResetRedirectThreat().

◆ SetResistance()

◆ SetRooted()

void Unit::SetRooted ( bool  apply,
bool  stun = false,
bool  logout = false 
)
protected
14578{
14579 const uint32 state = (stun ? (logout ? UNIT_STATE_LOGOUT_TIMER : UNIT_STATE_STUNNED) : UNIT_STATE_ROOT);
14580
14581 if (apply)
14582 {
14583 AddUnitState(state);
14584
14585 SendMoveRoot(true);
14586 }
14587 else
14588 {
14589 ClearUnitState(state);
14590
14591 // Prevent giving ability to move if more immobilizers are active
14592 if (!IsImmobilizedState())
14593 SendMoveRoot(false);
14594 }
14595}
@ UNIT_STATE_LOGOUT_TIMER
Definition UnitDefines.h:202
bool IsImmobilizedState() const
Definition Unit.h:779
void SendMoveRoot(bool state)
Definition Unit.cpp:14597

References AddUnitState(), ClearUnitState(), IsImmobilizedState(), SendMoveRoot(), UNIT_STATE_LOGOUT_TIMER, UNIT_STATE_ROOT, and UNIT_STATE_STUNNED.

Referenced by WorldSession::HandleLogoutCancelOpcode(), WorldSession::HandleLogoutRequestOpcode(), WorldSession::HandlePlayerLoginToCharInWorld(), SetControlled(), and SetStunned().

◆ SetShapeshiftForm()

void Unit::SetShapeshiftForm ( ShapeshiftForm  form)
17473{
17475 sScriptMgr->OnUnitSetShapeshiftForm((Unit*)this, form);
17476}

References Object::SetByteValue(), sScriptMgr, and UNIT_FIELD_BYTES_2.

Referenced by AuraEffect::HandleAuraModShapeshift(), and reset_commandscript::HandleResetStatsOrLevelHelper().

◆ SetSheath()

◆ SetSpeed()

void Unit::SetSpeed ( UnitMoveType  mtype,
float  rate,
bool  forced = false 
)
11369{
11370 if (rate < 0)
11371 rate = 0.0f;
11372
11373 // Update speed only on change
11374 if (m_speed_rate[mtype] == rate)
11375 return;
11376
11377 m_speed_rate[mtype] = rate;
11378
11380
11381 SpeedOpcodePair const& speedOpcodes = SetSpeed2Opc_table[mtype];
11382
11383 if (forced && IsClientControlled())
11384 {
11385 Player* player = const_cast<Player*>(GetClientControlling());
11386 uint32 const counter = player->GetSession()->GetOrderCounter();
11387
11388 // register forced speed changes for WorldSession::HandleForceSpeedChangeAck
11389 // and do it only for real sent packets and use run for run/mounted as client expected
11390 ++player->m_forced_speed_changes[mtype];
11391
11392 WorldPacket data(speedOpcodes[static_cast<size_t>(SpeedOpcodeIndex::PC)], 18);
11393 data << GetPackGUID();
11394 data << counter;
11395 if (mtype == MOVE_RUN)
11396 data << uint8(0); // new 2.1.0
11397
11398 data << GetSpeed(mtype);
11399 player->GetSession()->SendPacket(&data);
11400 player->GetSession()->IncrementOrderCounter();
11401 }
11402 else if (forced)
11403 {
11404 WorldPacket data(speedOpcodes[static_cast<size_t>(SpeedOpcodeIndex::NPC)], 12);
11405 data << GetPackGUID();
11406 data << float(GetSpeed(mtype));
11407 SendMessageToSet(&data, true);
11408 }
11409
11410 if (IsPlayer())
11411 {
11412 // Xinef: update speed of pet also
11413 if (!IsInCombat())
11414 {
11415 Unit* pet = ToPlayer()->GetPet();
11416 if (!pet)
11417 pet = GetCharm();
11418
11419 // xinef: do not affect vehicles and possesed pets
11420 if (pet && (pet->HasUnitFlag(UNIT_FLAG_POSSESSED) || pet->IsVehicle()))
11421 pet = nullptr;
11422
11423 if (pet && pet->IsCreature() && !pet->IsInCombat() && pet->GetMotionMaster()->GetCurrentMovementGeneratorType() == FOLLOW_MOTION_TYPE)
11424 pet->UpdateSpeed(mtype, forced);
11425
11426 if (Unit* critter = ObjectAccessor::GetUnit(*this, GetCritterGUID()))
11427 critter->UpdateSpeed(mtype, forced);
11428 }
11429 ToPlayer()->SetCanTeleport(true);
11430 }
11431}
@ FOLLOW_MOTION_TYPE
Definition MotionMaster.h:54
const Opcodes SpeedOpcodePair[static_cast< size_t >(SpeedOpcodeIndex::MAX)]
Definition Unit.h:643
SpeedOpcodePair SetSpeed2Opc_table[MAX_MOVE_TYPE]
Definition Unit.h:644
MovementGeneratorType GetCurrentMovementGeneratorType() const
Definition MotionMaster.cpp:949
uint8 m_forced_speed_changes[MAX_MOVE_TYPE]
Definition Player.h:2433
float GetSpeed(UnitMoveType mtype) const
Definition Unit.cpp:11363
void propagateSpeedChange()
Definition Unit.h:1729

References FOLLOW_MOTION_TYPE, GetCharm(), GetClientControlling(), GetCritterGUID(), MotionMaster::GetCurrentMovementGeneratorType(), GetMotionMaster(), WorldSession::GetOrderCounter(), Object::GetPackGUID(), Player::GetPet(), Player::GetSession(), GetSpeed(), ObjectAccessor::GetUnit(), HasUnitFlag(), WorldSession::IncrementOrderCounter(), IsClientControlled(), Object::IsCreature(), IsInCombat(), Object::IsPlayer(), IsVehicle(), Player::m_forced_speed_changes, m_speed_rate, MOVE_RUN, NPC, PC, propagateSpeedChange(), WorldObject::SendMessageToSet(), WorldSession::SendPacket(), Player::SetCanTeleport(), SetSpeed2Opc_table, Object::ToPlayer(), UNIT_FLAG_POSSESSED, and UpdateSpeed().

Referenced by Battleground::AddCreature(), boss_bug_trio::DoAction(), boss_sindragosa::boss_sindragosaAI::DoAction(), brann_bronzebeard::brann_bronzebeardAI::DoAction(), boss_grand_champion::boss_grand_championAI::DoAction(), npc_spark_of_ionar::DoAction(), npc_pet_dk_ebon_gargoyle::FlyAway(), boss_volkhan::GoToAnvil(), misc_commandscript::HandleDismountCommand(), spell_mount_check_aura::HandleEffectPeriodic(), boss_sartharion_dragonAI::HandleExtraEvent(), WorldSession::HandleForceSpeedChangeAck(), modify_commandscript::HandleModifyASpeedCommand(), modify_commandscript::HandleModifyMountCommand(), Creature::InitEntry(), boss_glob_of_viscidus::InitializeAI(), Guardian::InitStatsForLevel(), npc_infra_green_bomber_generic::npc_infra_green_bomber_genericAI::IsSummonedBy(), boss_sartharion_dragonAI::JustEngagedWith(), boss_four_horsemen::boss_four_horsemenAI::JustEngagedWith(), boss_ichoron::boss_ichoronAI::JustSummoned(), boss_sartharion::JustSummoned(), npc_thrall_old_hillsbrad::npc_thrall_old_hillsbradAI::MountSelf(), boss_onyxia::MovementInform(), boss_bug_trio::MovementInform(), boss_volkhan::MovementInform(), boss_sindragosa::boss_sindragosaAI::MovementInform(), npc_akilzon_eagle::MovementInform(), npc_hor_leader_second::npc_hor_leader_secondAI::MoveToNextStopPoint(), npc_ancestral_wolf::npc_ancestral_wolfAI::npc_ancestral_wolfAI(), npc_batrider::npc_batrider(), npc_hallows_end_soh::npc_hallows_end_soh(), npc_mechanolift::npc_mechanolift(), npc_toc5_player_vehicle::npc_toc5_player_vehicleAI::OnCharmed(), instance_halls_of_reflection::instance_halls_of_reflection_InstanceMapScript::OnCreatureCreate(), npc_vehicle_d16_propelled_delivery::npc_vehicle_d16_propelled_deliveryAI::PassengerBoarded(), npc_hover_disk::PassengerBoarded(), npc_eastvale_peasent::PathEndReached(), SmartScript::ProcessAction(), boss_nightbane::Reset(), npc_zuljin_vortex::Reset(), boss_headless_horseman::Reset(), boss_onyxia::Reset(), boss_bug_trio::Reset(), boss_sartharion_dragonAI::Reset(), boss_sindragosa::boss_sindragosaAI::Reset(), npc_oculus_unstable_sphere::npc_oculus_unstable_sphereAI::Reset(), boss_volkhan::Reset(), boss_thorim_sif_blizzard::Reset(), npc_freed_protodrake::npc_freed_protodrakeAI::Reset(), npc_dream_fog::npc_dream_fogAI::ScheduleEvents(), npc_eastvale_peasent::SetData(), Battlefield::SpawnCreature(), npc_thrall_old_hillsbrad::npc_thrall_old_hillsbradAI::UnMountSelf(), npc_akilzon_eagle::UpdateAI(), boss_onyxia::UpdateAI(), npc_hor_leader::npc_hor_leaderAI::UpdateAI(), npc_hor_lich_king::npc_hor_lich_kingAI::UpdateAI(), npc_hor_leader_second::npc_hor_leader_secondAI::UpdateAI(), boss_sindragosa::boss_sindragosaAI::UpdateAI(), boss_yoggsaron_death_orb::UpdateAI(), npc_infra_green_bomber_generic::npc_infra_green_bomber_genericAI::UpdateAI(), npc_ulduar_mimiron_rocket::UpdateAI(), UpdateSpeed(), and npc_ancestral_wolf::npc_ancestral_wolfAI::WaypointReached().

◆ SetSpeedRate()

◆ SetStandFlags()

◆ SetStandState()

void Unit::SetStandState ( uint8  state)
13229{
13231
13232 if (IsStandState())
13234
13235 if (IsPlayer())
13236 {
13238 data << (uint8)state;
13239 ToPlayer()->SendDirectMessage(&data);
13240 }
13241}
@ UNIT_BYTES_1_OFFSET_STAND_STATE
Definition UnitDefines.h:23
@ SMSG_STANDSTATE_UPDATE
Definition Opcodes.h:699

References AURA_INTERRUPT_FLAG_NOT_SEATED, Object::IsPlayer(), IsStandState(), RemoveAurasWithInterruptFlags(), Player::SendDirectMessage(), Object::SetByteValue(), SMSG_STANDSTATE_UPDATE, Object::ToPlayer(), UNIT_BYTES_1_OFFSET_STAND_STATE, and UNIT_FIELD_BYTES_1.

Referenced by _ApplyAura(), spell_the_cleansing_cleansing_soul::AfterApply(), spell_the_cleansing_cleansing_soul::AfterRemove(), boss_kologarn::boss_kologarn(), boss_twinemperorsAI::boss_twinemperorsAI(), boss_thekal::CheckPhaseTransition(), npc_ringo::npc_ringoAI::ClearFaint(), npc_kerlonian::npc_kerlonianAI::ClearSleeping(), CombatStart(), npc_vrykul_skeleton::DamageTaken(), boss_alar::DamageTaken(), boss_thekal::DamageTaken(), boss_shade_of_aran::DamageTaken(), boss_nightbane::DoAction(), boss_twinemperorsAI::DoAction(), npc_twilight_volunteer::DoAction(), boss_the_lurker_below::DoAction(), boss_leotheras_the_blind::DoAction(), npc_madrigosa::DoAction(), boss_illidan_stormrage::DoAction(), boss_reliquary_of_souls::boss_reliquary_of_soulsAI::DoAction(), npc_taretha::npc_tarethaAI::DoAction(), Spell::DoAllEffectOnTarget(), npc_unkor_the_ruthless::npc_unkor_the_ruthlessAI::DoNice(), boss_ahune::Emerge(), UtherBatteredHiltEvent::Execute(), SuckBackEvent::Execute(), boss_ahune::ExecuteEvent(), boss_ingvar_the_plunderer::FeignDeath(), WorldSession::HandleAlterAppearance(), WorldSession::HandleLogoutCancelOpcode(), WorldSession::HandleLogoutRequestOpcode(), WorldSession::HandlePlayerLoginFromDB(), AuraEffect::HandleSpiritOfRedemption(), WorldSession::HandleStandStateChangeOpcode(), DistractMovementGenerator::Initialize(), boss_felmyst::InitializeAI(), npc_ranshalla::npc_ranshallaAI::JustDidDialogueStep(), boss_kalecgos::JustEngagedWith(), boss_palehoof::boss_palehoofAI::JustReachedHome(), npc_massive_jormungar::npc_massive_jormungarAI::JustReachedHome(), npc_ferocious_rhino::npc_ferocious_rhinoAI::JustReachedHome(), npc_ravenous_furbolg::npc_ravenous_furbolgAI::JustReachedHome(), npc_frenzied_worgen::npc_frenzied_worgenAI::JustReachedHome(), npc_highlord_darion_mograine::npc_highlord_darion_mograineAI::JustRespawned(), boss_yoggsaron_brain::JustSummoned(), npc_wizzlecrank_shredder::npc_wizzlecrank_shredderAI::JustSummoned(), boss_anubarak_trial::boss_anubarak_trialAI::MoveInLineOfSight(), boss_kologarn::MoveInLineOfSight(), boss_reliquary_of_souls::boss_reliquary_of_soulsAI::MoveInLineOfSight(), npc_koltira_deathweaver::npc_koltira_deathweaverAI::MovementInform(), npc_twilight_volunteer::MovementInform(), boss_mr_smite::boss_mr_smiteAI::MovementInform(), npc_madrigosa::npc_madrigosa(), spell_love_is_in_the_air_romantic_picnic::OnApply(), boss_shade_of_aran::OnPowerUpdate(), npc_kernobee::OnQuestAccept(), npc_kerlonian::OnQuestAccept(), npc_gilthares::OnQuestAccept(), npc_ringo::OnQuestAccept(), npc_maghar_captive::OnQuestAccept(), npc_mootoo_the_younger::OnQuestAccept(), npc_bonker_togglevolt::OnQuestAccept(), spell_q12937_relief_for_the_fallen::OnRemove(), boss_reliquary_of_souls::boss_reliquary_of_soulsAI::PhaseTransitionSpawns(), Spell::prepare(), PretendToDie(), boss_alar::PretendToDie(), WorldSession::ProcessMovementInfo(), boss_victor_nefarius::boss_victor_nefariusAI::Reset(), boss_vaelastrasz::boss_vaelAI::Reset(), boss_mr_smite::boss_mr_smiteAI::Reset(), boss_kalecgos::Reset(), npc_bh_thalorien_dawnseeker::npc_bh_thalorien_dawnseekerAI::Reset(), npc_thrall_bfu::npc_thrall_bfuAI::Reset(), boss_thekal::Reset(), npc_draenei_survivor::npc_draenei_survivorAI::Reset(), npc_injured_draenei::npc_injured_draeneiAI::Reset(), npc_rabid_thistle_bear::npc_rabid_thistle_bearAI::Reset(), npc_wizzlecrank_shredder::npc_wizzlecrank_shredderAI::Reset(), boss_anubarak_trial::boss_anubarak_trialAI::Reset(), boss_professor_putricide::boss_professor_putricideAI::Reset(), boss_the_lich_king::boss_the_lich_kingAI::Reset(), npc_imprisoned_beryl_sorcerer::npc_imprisoned_beryl_sorcererAI::Reset(), npc_tirions_gambit_tirion::npc_tirions_gambit_tirionAI::Reset(), boss_illidan_stormrage::Reset(), boss_reliquary_of_souls::boss_reliquary_of_soulsAI::Reset(), boss_leotheras_the_blind::Reset(), boss_the_lurker_below::Reset(), npc_unkor_the_ruthless::npc_unkor_the_ruthlessAI::Reset(), Resurrect(), boss_the_lurker_below::SchedulerPhaseOne(), boss_the_lurker_below::SchedulerPhaseTwo(), npc_ringo::npc_ringoAI::SetFaint(), npc_kurenai_captive::npc_kurenai_captiveAI::SetGUID(), SetInCombatState(), npc_kerlonian::npc_kerlonianAI::SetSleeping(), SetStunned(), boss_victor_nefarius::boss_victor_nefariusAI::sGossipSelect(), npc_harrison_jones::SpellHit(), npc_draenei_survivor::npc_draenei_survivorAI::SpellHit(), npc_wounded_skirmisher::SpellHit(), advisor_baseAI::SpellHit(), npc_koltira_deathweaver::npc_koltira_deathweaverAI::StartEvent(), boss_felmyst::StartIntro(), boss_ahune::Submerge(), npc_commander_dawnforge::npc_commander_dawnforgeAI::Turn_to_eachother(), npc_commander_dawnforge::npc_commander_dawnforgeAI::Turn_to_Pathaleons_Image(), boss_vaelastrasz::boss_vaelAI::UpdateAI(), boss_mr_smite::boss_mr_smiteAI::UpdateAI(), npc_a_special_surprise::npc_a_special_surpriseAI::UpdateAI(), npc_highlord_darion_mograine::npc_highlord_darion_mograineAI::UpdateAI(), npc_madrigosa::UpdateAI(), npc_bh_thalorien_dawnseeker::npc_bh_thalorien_dawnseekerAI::UpdateAI(), npc_corporal_keeshan::npc_corporal_keeshanAI::UpdateAI(), npc_varian_wrynn::npc_varian_wrynnAI::UpdateAI(), npc_thrall_bfu::npc_thrall_bfuAI::UpdateAI(), npc_forest_frog::UpdateAI(), npc_alexstraza_the_lifebinder::UpdateAI(), npc_thrall_old_hillsbrad::npc_thrall_old_hillsbradAI::UpdateAI(), boss_professor_putricide::boss_professor_putricideAI::UpdateAI(), boss_algalon_the_observer::UpdateAI(), npc_vrykul_skeleton::UpdateAI(), npc_tirions_gambit_tirion::npc_tirions_gambit_tirionAI::UpdateEscortAI(), GameObject::Use(), and npc_ancestral_wolf::npc_ancestral_wolfAI::WaypointReached().

◆ SetStat()

void Unit::SetStat ( Stats  stat,
int32  val 
)
inline

◆ SetStatFlatModifier()

void Unit::SetStatFlatModifier ( UnitMods  unitMod,
UnitModifierFlatType  modifierType,
float  val 
)

◆ SetStatPctModifier()

◆ SetStunned()

void Unit::SetStunned ( bool  apply)
protected
14532{
14533 if (IsInFlight())
14534 return;
14535
14536 if (apply)
14537 {
14538 SetTarget();
14540
14541 if (IsPlayer())
14542 {
14544 }
14545
14546 SetRooted(true, true);
14547
14548 CastStop();
14549 }
14550 else
14551 {
14552 if (IsAlive() && GetVictim())
14554
14555 if (IsCreature())
14556 {
14557 // don't remove UNIT_FLAG_STUNNED for pet when owner is mounted (disabled pet's interface)
14558 Unit* owner = GetOwner();
14559 if (!owner || !owner->IsPlayer() || !owner->ToPlayer()->IsMounted())
14561
14562 // Xinef: same for charmed npcs
14563 owner = GetCharmer();
14564 if (!owner || !owner->IsPlayer() || !owner->ToPlayer()->IsMounted())
14566 }
14567 else
14569
14570 if (!HasUnitState(UNIT_STATE_ROOT)) // prevent moving if it also has root effect
14571 {
14572 SetRooted(false, true);
14573 }
14574 }
14575}

References CastStop(), GetCharmer(), Object::GetGUID(), GetOwner(), GetVictim(), HasUnitState(), IsAlive(), Object::IsCreature(), IsInFlight(), IsMounted(), Object::IsPlayer(), RemoveUnitFlag(), SetRooted(), SetStandState(), SetTarget(), SetUnitFlag(), Object::ToPlayer(), UNIT_FLAG_STUNNED, UNIT_STAND_STATE_STAND, and UNIT_STATE_ROOT.

Referenced by SetControlled().

◆ SetSwim()

bool Unit::SetSwim ( bool  enable)
virtual

◆ SetTarget()

virtual void Unit::SetTarget ( ObjectGuid  = ObjectGuid::Empty)
pure virtual

◆ setTransForm()

void Unit::setTransForm ( uint32  spellid)
inline
1950{ m_transform = spellid;}

References m_transform.

Referenced by AuraEffect::HandleAuraTransform().

◆ SetUInt32Value()

void Unit::SetUInt32Value ( uint16  index,
uint32  value 
)
17534{
17535 Object::SetUInt32Value(index, value);
17536
17537 switch (index)
17538 {
17539 // Invalidating the cache on health change should fix an issue where the client sees dead NPCs when they are not.
17540 // We might also need to invalidate the cache for some other fields as well.
17541 case UNIT_FIELD_HEALTH:
17543 break;
17544 }
17545}
void SetUInt32Value(uint16 index, uint32 value)
Definition Object.cpp:639
void InvalidateValuesUpdateCache()
Definition Unit.h:2207

References InvalidateValuesUpdateCache(), Object::SetUInt32Value(), and UNIT_FIELD_HEALTH.

Referenced by Player::_LoadDailyQuestStatus(), Player::_LoadSkills(), Player::AddItemToBuyBackSlot(), Attack(), Player::CheckAreaExploreAndOutdoor(), Spell::CheckItems(), Player::Create(), Pet::CreateBaseAtTamed(), Player::CreatePet(), Player::CreatePet(), boss_grand_champion::boss_grand_championAI::DamageTaken(), npc_ulduar_vx001::DamageTaken(), Dismount(), npc_harrison_jones::DoAction(), boss_thekal::DoAction(), boss_razuvious_minion::boss_razuvious_minionAI::DoAction(), brann_bronzebeard::brann_bronzebeardAI::DoAction(), boss_pathaleon_the_calculator::DoAction(), npc_pos_martin_or_gorkun_second::npc_pos_martin_or_gorkun_secondAI::DoAction(), npc_black_knight_skeletal_gryphon::npc_black_knight_skeletal_gryphonAI::DoAction(), boss_illidan_stormrage::DoAction(), Player::DuelComplete(), Spell::EffectSummonPet(), Spell::EffectTameCreature(), boss_jindo::EnterEvadeMode(), boss_zuljin::EnterPhase(), npc_unworthy_initiate::npc_unworthy_initiateAI::EventStart(), Player::GiveLevel(), Pet::GivePetLevel(), Pet::GivePetXP(), Player::GiveXP(), npc_torloth_the_magnificent::npc_torloth_the_magnificentAI::HandleAnimation(), AuraEffect::HandleAuraDummy(), AuraEffect::HandleAuraModIncreaseFlightSpeed(), AuraEffect::HandleAuraTransform(), character_commandscript::HandleCharacterLevel(), debug_commandscript::HandleDebugMod32ValueCommand(), debug_commandscript::HandleDebugUpdateCommand(), spell_dk_dancing_rune_weapon_visual::HandleEffectApply(), spell_gen_model_visible::HandleEffectApply(), spell_gen_model_visible::HandleEffectRemove(), spell_gen_baby_murloc::HandleEffectRemove(), boss_ragnaros::boss_ragnarosAI::HandleEmerge(), misc_commandscript::HandleHideAreaCommand(), modify_commandscript::HandleModifyStandStateCommand(), modify_commandscript::HandleMorphMountCommand(), AuraEffect::HandleNoReagentUseAura(), npc_commandscript::HandleNpcPlayEmoteCommand(), WorldSession::HandlePetRename(), reset_commandscript::HandleResetHonorCommand(), reset_commandscript::HandleResetLevelCommand(), reset_commandscript::HandleResetStatsOrLevelHelper(), WorldSession::HandleSelfResOpcode(), WorldSession::HandleSetTitleOpcode(), WorldSession::HandleSetWatchedFactionOpcode(), misc_commandscript::HandleShowAreaCommand(), WorldSession::HandleTextEmoteOpcode(), titles_commandscript::HandleTitlesCurrentCommand(), titles_commandscript::HandleTitlesRemoveCommand(), titles_commandscript::HandleTitlesSetMaskCommand(), Player::InitGlyphsForLevel(), npc_rabid_thistle_bear::npc_rabid_thistle_bearAI::Initialize(), npc_icc_nerubar_broodkeeper::npc_icc_nerubar_broodkeeperAI::InitializeAI(), Player::InitStatsForLevel(), Guardian::InitStatsForLevel(), InitTamedPet(), npc_toc5_grand_champion_minion::npc_toc5_grand_champion_minionAI::JustDied(), boss_xt002::JustEngagedWith(), npc_dragonflayer_forge_master::JustEngagedWith(), boss_jindo::JustEngagedWith(), npc_tirion_fordring_tft::npc_tirion_fordringAI::JustReachedHome(), npc_akama_illidan::JustReachedHome(), npc_highlord_darion_mograine::npc_highlord_darion_mograineAI::JustSummoned(), npc_tirions_gambit_tirion::npc_tirions_gambit_tirionAI::JustSummoned(), npc_thrall_bfu::npc_thrall_bfuAI::JustSummoned(), Kill(), Creature::LoadCreaturesAddon(), Creature::LoadEquipment(), Player::LoadFromDB(), Pet::LoadPetFromDB(), WorldSession::LogoutPlayer(), Player::ModifySkillBonus(), Mount(), npc_icc_nerubar_broodkeeper::npc_icc_nerubar_broodkeeperAI::MoveInLineOfSight(), npc_harrison_jones::MovementInform(), boss_grand_champion::boss_grand_championAI::MovementInform(), boss_professor_putricide::boss_professor_putricideAI::MovementInform(), npc_tirion_fordring_tft::npc_tirion_fordringAI::MovementInform(), npc_akama_illidan::MovementInform(), npc_apothecary_genericAI::MovementInform(), npc_pos_martin_or_gorkun_second::npc_pos_martin_or_gorkun_secondAI::npc_pos_martin_or_gorkun_secondAI(), spell_gen_clone_weapon_aura::OnApply(), instance_trial_of_the_champion::instance_trial_of_the_champion_InstanceMapScript::OnCreatureCreate(), instance_halls_of_reflection::instance_halls_of_reflection_InstanceMapScript::OnCreatureCreate(), npc_ame::OnQuestAccept(), go_crystalline_tear::OnQuestAccept(), spell_gen_clone_weapon_aura::OnRemove(), npc_eastvale_peasent::PathEndReached(), npc_hidden_cultist::npc_hidden_cultistAI::PreScript(), WorldSession::ProcessMovementInfo(), Player::RemoveAmmo(), Player::RemoveItemFromBuyBackSlot(), npc_thrall_old_hillsbrad::npc_thrall_old_hillsbradAI::ReorderInstance(), ReplaceAllDynamicFlags(), ReplaceAllNpcFlags(), Player::ReplaceAllPlayerFlags(), ReplaceAllUnitFlags(), ReplaceAllUnitFlags2(), boss_ragnaros::boss_ragnarosAI::Reset(), npc_unworthy_initiate::npc_unworthy_initiateAI::Reset(), npc_bh_thalorien_dawnseeker::npc_bh_thalorien_dawnseekerAI::Reset(), boss_zuljin::Reset(), boss_arlokk::boss_arlokkAI::Reset(), boss_grand_champion::boss_grand_championAI::Reset(), npc_hor_leader::npc_hor_leaderAI::Reset(), boss_malygos::Reset(), npc_ulduar_leviathan_mkii::Reset(), npc_hidden_cultist::npc_hidden_cultistAI::Reset(), npc_crusade_recruit::npc_crusade_recruitAI::Reset(), npc_injured_patient::npc_injured_patientAI::Reset(), Player::ResetDailyQuestStatus(), boss_razuvious_minion::boss_razuvious_minionAI::ScheduleAttackDummy(), Spell::SendChannelStart(), Spell::SendChannelUpdate(), Player::SetAmmo(), Player::SetArenaPoints(), Player::SetArenaTeamInfoField(), SetCharmedBy(), SetCreateHealth(), SetCreateMana(), Player::SetCurrentTitle(), Player::SetDailyQuestStatus(), npc_ulduar_vx001::SetData(), npc_ulduar_expedition_engineer::SetData(), npc_eastvale_peasent::SetData(), setDeathState(), Player::setDeathState(), SetDisplayId(), SetEmoteState(), SetFaction(), Player::SetFreePrimaryProfessions(), Player::SetFreeTalentPoints(), Player::SetGlyph(), Player::SetGlyphSlot(), SetHealth(), Player::SetHonorPoints(), Player::SetInGuild(), SetLevel(), SetMaxHealth(), Player::SetMoney(), SetNativeDisplayId(), CharmInfo::SetPetNumber(), Player::SetQuestSlot(), Player::SetQuestSlotTimer(), Player::SetRank(), Player::SetRestBonus(), Player::SetSkill(), SetVirtualItem(), Player::SetVisibleItemSlot(), npc_injured_patient::npc_injured_patientAI::SpellHit(), npc_icc_valkyr_herald::npc_icc_valkyr_heraldAI::SpellHitTarget(), Map::SummonCreature(), npc_bh_thalorien_dawnseeker::npc_bh_thalorien_dawnseekerAI::SummonedCreatureDespawn(), Player::SummonPet(), Player::SwapQuestSlot(), boss_ragnaros::boss_ragnarosAI::UpdateAI(), npc_highlord_darion_mograine::npc_highlord_darion_mograineAI::UpdateAI(), boss_kirtonos_the_herald::boss_kirtonos_the_heraldAI::UpdateAI(), npc_madrigosa::UpdateAI(), npc_partygoer_pather::UpdateAI(), npc_partygoer::UpdateAI(), npc_bh_thalorien_dawnseeker::npc_bh_thalorien_dawnseekerAI::UpdateAI(), boss_arlokk::boss_arlokkAI::UpdateAI(), npc_thrall_old_hillsbrad::npc_thrall_old_hillsbradAI::UpdateAI(), npc_clintar_spirit::npc_clintar_spiritAI::UpdateAI(), npc_hor_leader::npc_hor_leaderAI::UpdateAI(), npc_hor_leader_second::npc_hor_leader_secondAI::UpdateAI(), npc_pos_leader::npc_pos_leaderAI::UpdateAI(), npc_tirion_fordring_tft::npc_tirion_fordringAI::UpdateAI(), boss_malygos::UpdateAI(), boss_mimiron::UpdateAI(), npc_ulduar_expedition_engineer::UpdateAI(), npc_crusade_recruit::npc_crusade_recruitAI::UpdateAI(), npc_dragonmaw_peon::npc_dragonmaw_peonAI::UpdateAI(), Player::UpdateArmorPenetration(), Player::UpdateDuelFlag(), brann_bronzebeard::brann_bronzebeardAI::UpdateEscortAI(), Player::UpdateExpertise(), Player::UpdateHonorFields(), Player::UpdateRating(), Player::UpdateShieldBlockValue(), Player::UpdateSkill(), Player::UpdateSkillPro(), Player::UpdateSkillsForLevel(), Player::UpdateSkillsToMaxSkillsForLevel(), npc_black_knight_skeletal_gryphon::npc_black_knight_skeletal_gryphonAI::WaypointReached(), and npc_ranger_lilatha::WaypointReached().

◆ SetUnitFlag()

void Unit::SetUnitFlag ( UnitFlags  flags)
inline

UnitFlags available in UnitDefines.h.

742{ SetFlag(UNIT_FIELD_FLAGS, flags); }

References Object::SetFlag(), and UNIT_FIELD_FLAGS.

Referenced by BattlegroundAV::AddAVCreature(), Vehicle::AddPassenger(), boss_yoggsaron_sara::AddPortals(), Creature::AllLootRemovedFromCorpse(), npc_doctor::npc_doctorAI::BeginEvent(), boss_jarien::boss_jarien(), boss_sothos::boss_sothos(), GameObject::CastSpell(), Player::Create(), boss_apothecary_hummel::boss_apothecary_hummelAI::DamageTaken(), boss_muru::DamageTaken(), boss_jedoga_shadowseeker::DamageTaken(), boss_eadric::boss_eadricAI::DamageTaken(), boss_paletress::boss_paletressAI::DamageTaken(), boss_black_knight::boss_black_knightAI::DamageTaken(), boss_grand_champion::boss_grand_championAI::DamageTaken(), npc_frost_sphere::npc_frost_sphereAI::DamageTaken(), boss_bronjahm::boss_bronjahmAI::DamageTaken(), npc_terenas_menethil::npc_terenas_menethilAI::DamageTaken(), boss_algalon_the_observer::DamageTaken(), boss_freya::DamageTaken(), boss_hodir::DamageTaken(), npc_ulduar_leviathan_mkii::DamageTaken(), npc_ulduar_vx001::DamageTaken(), npc_ulduar_aerial_command_unit::DamageTaken(), boss_ingvar_the_plunderer::DamageTaken(), npc_vrykul_skeleton::DamageTaken(), npc_overlord_drakuru_betrayal::DamageTaken(), boss_essence_of_suffering::boss_essence_of_sufferingAI::DamageTaken(), boss_essence_of_desire::boss_essence_of_desireAI::DamageTaken(), advisor_baseAI::DamageTaken(), boss_taerar::boss_taerarAI::DamageTaken(), npc_molten_golem::DamageTaken(), boss_felblood_kaelthas::DamageTaken(), npc_tiger_matriarch::npc_tiger_matriarchAI::DamageTaken(), boss_mal_ganis::boss_mal_ganisAI::DamageTaken(), boss_thorim::DamageTaken(), npc_q24545_wretched_ghoul::npc_q24545_wretched_ghoulAI::Deactivate(), DisableRotate(), boss_thorim::DisableThorim(), boss_kirtonos_the_herald::boss_kirtonos_the_heraldAI::DoAction(), npc_amanishi_lookout::DoAction(), boss_sindragosa::boss_sindragosaAI::DoAction(), npc_crok_scourgebane::npc_crok_scourgebaneAI::DoAction(), boss_algalon_the_observer::DoAction(), npc_frozen_core::DoAction(), boss_kalecgos::DoAction(), boss_grand_champion::boss_grand_championAI::DoAction(), boss_kelthuzad_minion::boss_kelthuzad_minionAI::DoAction(), npc_xt002_heart::DoAction(), boss_yoggsaron::DoAction(), boss_skadi::boss_skadiAI::DoAction(), boss_illidan_stormrage::DoAction(), PetAI::DoAttack(), FlightPathMovementGenerator::DoReset(), boss_yoggsaron_sara::EnableSara(), boss_cyanigosa::boss_cyanigosaAI::EnterEvadeMode(), boss_erekem::boss_erekemAI::EnterEvadeMode(), boss_ichoron::boss_ichoronAI::EnterEvadeMode(), boss_lavanthor::boss_lavanthorAI::EnterEvadeMode(), boss_moragg::boss_moraggAI::EnterEvadeMode(), boss_xevozz::boss_xevozzAI::EnterEvadeMode(), boss_zuramat::boss_zuramatAI::EnterEvadeMode(), boss_anubarak_trial::boss_anubarak_trialAI::EnterEvadeMode(), boss_jaraxxus::boss_jaraxxusAI::EnterEvadeMode(), boss_gormok::boss_gormokAI::EnterEvadeMode(), boss_jormungarAI::EnterEvadeMode(), boss_icehowl::boss_icehowlAI::EnterEvadeMode(), npc_crystalline_frayer::EnterSeedPod(), SACDeactivateEvent::Execute(), boss_kaelthas::ExecuteMiddleEvent(), boss_ingvar_the_plunderer::FeignDeath(), spell_boss_magus_telestra_summon_telestra_clones_aura::HandleApply(), AuraEffect::HandleArenaPreparation(), AuraEffect::HandleAuraModFaction(), AuraEffect::HandleAuraModPacify(), AuraEffect::HandleAuraModSilence(), spell_q13007_iron_colossus::HandleDummy(), spell_herald_volzaj_insanity::HandleDummyEffect(), spell_gen_model_visible::HandleEffectApply(), spell_gen_feign_death_all_flags::HandleEffectApply(), spell_gen_feign_death_no_dyn_flag::HandleEffectApply(), spell_gen_feign_death_no_prevent_emotes::HandleEffectApply(), boss_sartharion_dragonAI::HandleExtraEvent(), AuraEffect::HandleFeignDeath(), spell_chapter2_persuasive_strike::HandleHit(), BattlefieldWG::HandleKill(), Battleground::HandleKillPlayer(), WorldSession::HandleLogoutRequestOpcode(), spell_oculus_rider_aura::HandleOnEffectApply(), npc_echo_of_medivh::HandlePieceJustDied(), Battlefield::HideNpc(), npc_malchezaar_axe::Initialize(), npc_scarlet_ghoul::npc_scarlet_ghoulAI::InitializeAI(), boss_kiljaeden::InitializeAI(), npc_general_andorov::InitializeAI(), boss_sapphiron::boss_sapphironAI::InitializeAI(), Player::InitStatsForLevel(), boss_kologarn::JustDied(), boss_algalon_the_observer::JustEngagedWith(), boss_mimiron::JustEngagedWith(), boss_novos::JustEngagedWith(), boss_gothik::boss_gothikAI::JustEngagedWith(), boss_kelthuzad::boss_kelthuzadAI::JustEngagedWith(), npc_eris_hevenfire::npc_eris_hevenfireAI::JustSummoned(), boss_majordomo::boss_majordomoAI::JustSummoned(), npc_ravenclaw_apparition::npc_ravenclaw_apparitionAI::JustSummoned(), boss_hazzarah::JustSummoned(), boss_vaelastrasz::boss_vaelAI::JustSummoned(), npc_thrall_bfu::npc_thrall_bfuAI::JustSummoned(), boss_archimonde::JustSummoned(), boss_broggok::JustSummoned(), npc_varian_wrynn::npc_varian_wrynnAI::JustSummoned(), Mount(), npc_shattered_hand_scout::MoveInLineOfSight(), boss_kaelthas::MoveInLineOfSight(), npc_batrider::npc_batrider(), npc_blade_of_azzinoth::npc_blade_of_azzinoth(), npc_chess_move_trigger::npc_chess_move_trigger(), npc_mageguard_dalaran::npc_mageguard_dalaranAI::npc_mageguard_dalaranAI(), npc_pos_freed_slave::npc_pos_freed_slaveAI::npc_pos_freed_slaveAI(), npc_q24545_vegard::npc_q24545_vegardAI::npc_q24545_vegardAI(), npc_xt002_heart::npc_xt002_heart(), spell_halion_twilight_phasing_aura::OnApply(), npc_toc5_player_vehicle::npc_toc5_player_vehicleAI::OnCharmed(), instance_sunken_temple::instance_sunken_temple_InstanceMapScript::OnCreatureCreate(), instance_dire_maul::instance_dire_maul_InstanceMapScript::OnCreatureCreate(), boss_flame_leviathan_overload_device::OnSpellClick(), NPCStaveQuestAI::PrepareForEncounter(), PretendToDie(), boss_alar::PretendToDie(), Creature::RefreshSwimmingFlag(), boss_keristrasza::RemovePrison(), npc_grimstone::npc_grimstoneAI::Reset(), boss_pyroguard_emberseer::boss_pyroguard_emberseerAI::Reset(), boss_rend_blackhand::boss_rend_blackhandAI::Reset(), boss_nefarian::Reset(), boss_nightbane::Reset(), npc_death_knight_initiate::npc_death_knight_initiateAI::Reset(), npc_koltira_deathweaver::npc_koltira_deathweaverAI::Reset(), npc_valkyr_battle_maiden::npc_valkyr_battle_maidenAI::Reset(), boss_kiljaeden::Reset(), npc_zuljin_vortex::Reset(), npc_hallows_end_soh::Reset(), npc_ancient_wisp::Reset(), boss_cthun::Reset(), npc_draenei_survivor::npc_draenei_survivorAI::Reset(), npc_injured_draenei::npc_injured_draeneiAI::Reset(), npc_death_ravager::npc_death_ravagerAI::Reset(), npc_giant_spotlight::npc_giant_spotlightAI::Reset(), npc_anachronos_the_ancient::npc_anachronos_the_ancientAI::Reset(), boss_jedoga_shadowseeker::Reset(), boss_black_knight::boss_black_knightAI::Reset(), npc_announcer_toc5::npc_announcer_toc5AI::Reset(), boss_anubarak_trial::boss_anubarak_trialAI::Reset(), boss_novos::Reset(), boss_tyrannus::boss_tyrannusAI::Reset(), boss_drakkari_colossus::boss_drakkari_colossusAI::Reset(), boss_thaddius::boss_thaddiusAI::Reset(), boss_malygos::Reset(), boss_eregos::boss_eregosAI::Reset(), boss_urom::boss_uromAI::Reset(), boss_varos::boss_varosAI::Reset(), boss_flame_leviathan::Reset(), npc_ulduar_iron_construct::Reset(), npc_ulduar_leviathan_mkii::Reset(), boss_palehoof::boss_palehoofAI::Reset(), npc_massive_jormungar::npc_massive_jormungarAI::Reset(), npc_ferocious_rhino::npc_ferocious_rhinoAI::Reset(), npc_ravenous_furbolg::npc_ravenous_furbolgAI::Reset(), npc_frenzied_worgen::npc_frenzied_worgenAI::Reset(), boss_ymiron::boss_ymironAI::Reset(), boss_shade_of_akama::Reset(), boss_leotheras_the_blind::Reset(), boss_the_lurker_below::Reset(), boss_warlord_kalithresh::Reset(), boss_broggok::Reset(), boss_kelidan_the_breaker::Reset(), boss_magtheridon::Reset(), boss_kaelthas::Reset(), npc_deaths_fel_cannon::npc_deaths_fel_cannonAI::Reset(), npc_torloth_the_magnificent::npc_torloth_the_magnificentAI::Reset(), npc_injured_patient::npc_injured_patientAI::Reset(), instance_blood_furnace::instance_blood_furnace_InstanceMapScript::ResetPrisoner(), boss_the_lurker_below::SchedulerPhaseOne(), Player::SendLoot(), Player::SetBeastMaster(), SetCharm(), SetCharmedBy(), SetImmuneToNPC(), SetImmuneToPC(), SetInCombatState(), Player::SetIsSpectator(), SetMinion(), SetStunned(), SetSwim(), boss_victor_nefarius::boss_victor_nefariusAI::sGossipSelect(), Battlefield::ShowNpc(), npc_netherspite_infernal::SpellHit(), npc_harrison_jones::SpellHit(), boss_valithria_dreamwalker::boss_valithria_dreamwalkerAI::SpellHit(), boss_urom::boss_uromAI::SpellHit(), npc_wounded_skirmisher::SpellHit(), npc_venture_co_straggler::npc_venture_co_stragglerAI::SpellHit(), npc_nether_drake::npc_nether_drakeAI::SpellHit(), npc_injured_patient::npc_injured_patientAI::SpellHit(), boss_anub_arak::SpellHitTarget(), boss_noth::boss_nothAI::StartBalconyPhase(), boss_lord_valthalak::boss_lord_valthalakAI::StartTalking(), npc_giant_claw_tentacle::Submerge(), boss_ouro::Submerge(), boss_ahune::Submerge(), boss_jedoga_shadowseeker::SummonedCreatureDies(), boss_vaelastrasz::boss_vaelAI::UpdateAI(), boss_ragnaros::boss_ragnarosAI::UpdateAI(), boss_mr_smite::boss_mr_smiteAI::UpdateAI(), npc_madrigosa::UpdateAI(), boss_arlokk::boss_arlokkAI::UpdateAI(), npc_twiggy_flathead::npc_twiggy_flatheadAI::UpdateAI(), boss_grand_champion::boss_grand_championAI::UpdateAI(), boss_anubarak_trial::boss_anubarak_trialAI::UpdateAI(), npc_nerubian_burrower::npc_nerubian_burrowerAI::UpdateAI(), boss_jormungarAI::UpdateAI(), boss_krick::boss_krickAI::UpdateAI(), boss_drakkari_colossus::boss_drakkari_colossusAI::UpdateAI(), npc_kinetic_bomb::npc_kinetic_bombAI::UpdateAI(), npc_cult_fanatic::npc_cult_fanaticAI::UpdateAI(), npc_cult_adherent::npc_cult_adherentAI::UpdateAI(), npc_terenas_menethil::npc_terenas_menethilAI::UpdateAI(), npc_blistering_zombie::npc_blistering_zombieAI::UpdateAI(), boss_malygos::UpdateAI(), boss_algalon_the_observer::UpdateAI(), boss_stormcaller_brundir::UpdateAI(), boss_xt002::UpdateAI(), boss_ymiron::boss_ymironAI::UpdateAI(), npc_azure_saboteur::npc_azure_saboteurAI::UpdateAI(), npc_nether_drake::npc_nether_drakeAI::UpdateAI(), npc_artorius::npc_artoriusAI::UpdateAI(), npc_simone::npc_simoneAI::UpdateAI(), npc_nelson::npc_nelsonAI::UpdateAI(), npc_franklin::npc_franklinAI::UpdateAI(), npc_injured_patient::npc_injured_patientAI::UpdateAI(), boss_ichoron::boss_ichoronAI::UpdateAI(), and Creature::UpdateEntry().

◆ SetUnitFlag2()

◆ SetUnitMovementFlags()

◆ SetVirtualItem()

void Unit::SetVirtualItem ( uint32  slot,
uint32  itemId 
)
17387{
17388 if (slot >= MAX_EQUIPMENT_ITEMS)
17389 return;
17390
17392}

References MAX_EQUIPMENT_ITEMS, SetUInt32Value(), and UNIT_VIRTUAL_ITEM_SLOT_ID.

Referenced by ScriptedAI::SetEquipmentSlots().

◆ SetVisible()

void Unit::SetVisible ( bool  x)
11172{
11173 if (!x)
11175 else
11177
11179}
@ SEC_GAMEMASTER
Definition Common.h:59

References WorldObject::m_serverSideVisibility, SEC_GAMEMASTER, SEC_PLAYER, SERVERSIDE_VISIBILITY_GM, FlaggedValuesArray32< T_VALUES, T_FLAGS, FLAG_TYPE, ARRAY_SIZE >::SetValue(), and UpdateObjectVisibility().

Referenced by Creature::Create(), boss_muru::DamageTaken(), boss_alar::DamageTaken(), spell_rotface_unstable_ooze_explosion_suicide_aura::DespawnSelf(), boss_victor_nefarius::boss_victor_nefariusAI::DoAction(), boss_archimonde::DoAction(), boss_kalecgos::DoAction(), boss_yoggsaron_sara::DoAction(), boss_yoggsaron::DoAction(), npc_hor_spiritual_reflection::npc_hor_spiritual_reflectionAI::EnterEvadeMode(), HideNpcEvent::Execute(), UtherBatteredHiltEvent::Execute(), npc_anachronos_the_ancient::npc_anachronos_the_ancientAI::HandleAnimation(), BattlegroundSA::HandleKillUnit(), Battlefield::HideNpc(), boss_kiljaeden::InitializeAI(), boss_sapphiron::boss_sapphironAI::InitializeAI(), npc_time_lost_proto_drake::npc_time_lost_proto_drakeAI::InitializeAI(), npc_xt002_heart::JustDied(), SmartAI::JustRespawned(), npc_highlord_darion_mograine::npc_highlord_darion_mograineAI::JustRespawned(), boss_hazzarah::JustSummoned(), npc_overlord_drakuru_betrayal::MoveInLineOfSight(), npc_enslaved_netherwing_drake::MovementInform(), npc_blood_queen_lana_thel::npc_blood_queen_lana_thelAI::MovementInform(), boss_vazruden_the_herald::MovementInform(), npc_shattered_hand_scout::MovementInform(), npc_madrigosa::npc_madrigosa(), instance_culling_of_stratholme::instance_culling_of_stratholme_InstanceMapScript::OnCreatureCreate(), instance_old_hillsbrad::instance_old_hillsbrad_InstanceMapScript::OnCreatureCreate(), instance_forge_of_souls::instance_forge_of_souls_InstanceScript::OnCreatureCreate(), instance_halls_of_reflection::instance_halls_of_reflection_InstanceMapScript::OnCreatureCreate(), instance_pit_of_saron::instance_pit_of_saron_InstanceScript::OnCreatureCreate(), instance_icecrown_citadel::instance_icecrown_citadel_InstanceMapScript::OnCreatureCreate(), boss_victor_nefarius::boss_victor_nefariusAI::Reset(), boss_midnight::Reset(), npc_valkyr_battle_maiden::npc_valkyr_battle_maidenAI::Reset(), boss_darkmaster_gandling::boss_darkmaster_gandlingAI::Reset(), boss_muru::Reset(), npc_bh_thalorien_dawnseeker::npc_bh_thalorien_dawnseekerAI::Reset(), boss_archimonde::Reset(), boss_eye_of_cthun::Reset(), npc_murkdeep::npc_murkdeepAI::Reset(), npc_anachronos_quest_trigger::npc_anachronos_quest_triggerAI::Reset(), boss_halion::boss_halionAI::Reset(), npc_pos_leader::npc_pos_leaderAI::Reset(), npc_blood_queen_lana_thel::npc_blood_queen_lana_thelAI::Reset(), boss_ionar::Reset(), boss_yoggsaron_sara::Reset(), npc_minigob_manabonk::Reset(), npc_q24545_lich_king::npc_q24545_lich_kingAI::Reset(), npc_overlord_drakuru_betrayal::Reset(), boss_vazruden_the_herald::Reset(), npc_enslaved_netherwing_drake::Reset(), npc_lord_illidan_stormrage::npc_lord_illidan_stormrageAI::Reset(), npc_bh_thalorien_dawnseeker::npc_bh_thalorien_dawnseekerAI::SetData(), Battlefield::ShowNpc(), boss_ionar::Split(), boss_warchief_kargath_bladefist::SummonedCreatureDies(), instance_old_hillsbrad::instance_old_hillsbrad_InstanceMapScript::Update(), npc_valkyr_battle_maiden::npc_valkyr_battle_maidenAI::UpdateAI(), npc_madrigosa::UpdateAI(), npc_bh_thalorien_dawnseeker::npc_bh_thalorien_dawnseekerAI::UpdateAI(), npc_ravenclaw_apparition::npc_ravenclaw_apparitionAI::UpdateAI(), npc_arthas::npc_arthasAI::UpdateAI(), npc_murkdeep::npc_murkdeepAI::UpdateAI(), boss_halion::boss_halionAI::UpdateAI(), npc_hor_leader::npc_hor_leaderAI::UpdateAI(), npc_pos_leader::npc_pos_leaderAI::UpdateAI(), boss_sapphiron::boss_sapphironAI::UpdateAI(), boss_ionar::UpdateAI(), npc_vh_teleportation_portal::npc_vh_teleportation_portalAI::UpdateAI(), npc_minigob_manabonk::UpdateAI(), npc_q24545_lich_king::npc_q24545_lich_kingAI::UpdateAI(), npc_overlord_drakuru_betrayal::UpdateAI(), npc_commander_dawnforge::npc_commander_dawnforgeAI::UpdateAI(), SmartAI::UpdateDespawn(), npc_grimstone::npc_grimstoneAI::UpdateEscortAI(), npc_thrall_old_hillsbrad::npc_thrall_old_hillsbradAI::WaypointReached(), and npc_taretha::npc_tarethaAI::WaypointReached().

◆ SetVisibleAura()

void Unit::SetVisibleAura ( uint8  slot,
AuraApplication aur 
)
inline

◆ SetWalk()

bool Unit::SetWalk ( bool  enable)
virtual

Reimplemented in Creature.

16653{
16654 if (enable == IsWalking())
16655 return false;
16656
16657 if (enable)
16659 else
16661
16663 return true;
16664}

References AddUnitMovementFlag(), IsWalking(), MOVEMENTFLAG_WALKING, propagateSpeedChange(), and RemoveUnitMovementFlag().

Referenced by debug_commandscript::HandleDebugMoveflagsCommand(), SetCharm(), and Creature::SetWalk().

◆ SetWaterWalking()

void Unit::SetWaterWalking ( bool  enable)
16857{
16858 bool isClientControlled = IsClientControlled();
16859
16860 if (!isClientControlled)
16861 {
16862 if (enable)
16864 else
16866 }
16867
16868 if (!IsInWorld()) // is sent on add to map
16869 return;
16870
16871 if (isClientControlled)
16872 {
16873 if (Player const* player = GetClientControlling())
16874 {
16875 uint32 const counter = player->GetSession()->GetOrderCounter();
16876
16877 WorldPacket data(enable ? SMSG_MOVE_WATER_WALK : SMSG_MOVE_LAND_WALK, GetPackGUID().size() + 4);
16878 data << GetPackGUID();
16879 data << counter;
16880 player->SendDirectMessage(&data);
16881 player->GetSession()->IncrementOrderCounter();
16882 return;
16883 }
16884 }
16885
16887 data << GetPackGUID();
16888 SendMessageToSet(&data, true);
16889}
@ MOVEMENTFLAG_WATERWALKING
Definition UnitDefines.h:397
@ SMSG_MOVE_LAND_WALK
Definition Opcodes.h:253
@ SMSG_SPLINE_MOVE_LAND_WALK
Definition Opcodes.h:808
@ SMSG_MOVE_WATER_WALK
Definition Opcodes.h:252

References MovementInfo::AddMovementFlag(), GetClientControlling(), Object::GetPackGUID(), IsClientControlled(), Object::IsInWorld(), WorldObject::m_movementInfo, MOVEMENTFLAG_WATERWALKING, MovementInfo::RemoveMovementFlag(), WorldObject::SendMessageToSet(), PackedGuid::size(), SMSG_MOVE_LAND_WALK, SMSG_MOVE_WATER_WALK, SMSG_SPLINE_MOVE_LAND_WALK, and SMSG_SPLINE_MOVE_WATER_WALK.

Referenced by Player::BuildPlayerRepop(), AuraEffect::HandleAuraWaterWalk(), debug_commandscript::HandleDebugMoveflagsCommand(), cheat_commandscript::HandleWaterWalkCheatCommand(), and Player::ResurrectPlayer().

◆ SpellBaseDamageBonusDone()

int32 Unit::SpellBaseDamageBonusDone ( SpellSchoolMask  schoolMask)
8916{
8917 int32 DoneAdvertisedBenefit = GetTotalAuraModifier(SPELL_AURA_MOD_DAMAGE_DONE, [schoolMask](AuraEffect const* aurEff)
8918 {
8919 return aurEff->GetMiscValue() & schoolMask &&
8920 // -1 == any item class (not wand then)
8921 aurEff->GetSpellInfo()->EquippedItemClass == -1 &&
8922 // 0 == any inventory type (not wand then)
8924 });
8925
8926 if (IsPlayer())
8927 {
8928 // Base value
8929 DoneAdvertisedBenefit += ToPlayer()->GetBaseSpellPowerBonus();
8930 DoneAdvertisedBenefit += ToPlayer()->GetBaseSpellDamageBonus();
8931
8932 // Damage bonus from stats
8934 for (AuraEffectList::const_iterator i = mDamageDoneOfStatPercent.begin(); i != mDamageDoneOfStatPercent.end(); ++i)
8935 {
8936 if ((*i)->GetMiscValue() & schoolMask)
8937 {
8938 // stat used stored in miscValueB for this aura
8939 Stats usedStat = Stats((*i)->GetMiscValueB());
8940 DoneAdvertisedBenefit += int32(CalculatePct(GetStat(usedStat), (*i)->GetAmount()));
8941 }
8942 }
8943 // ... and attack power
8945 }
8946 return DoneAdvertisedBenefit;
8947}
@ SPELL_AURA_MOD_SPELL_DAMAGE_OF_ATTACK_POWER
Definition SpellAuraDefines.h:300
@ SPELL_AURA_MOD_SPELL_DAMAGE_OF_STAT_PERCENT
Definition SpellAuraDefines.h:237
@ SPELL_AURA_MOD_DAMAGE_DONE
Definition SpellAuraDefines.h:76
uint32 GetBaseSpellPowerBonus()
Definition Player.h:1987
uint32 GetBaseSpellDamageBonus()
Definition Player.h:1988
int32 EquippedItemInventoryTypeMask
Definition SpellInfo.h:377
float GetTotalAttackPowerValue(WeaponAttackType attType, Unit *pVictim=nullptr) const
Definition Unit.cpp:12438
float GetStat(Stats stat) const
Definition Unit.h:1047

References BASE_ATTACK, CalculatePct(), SpellInfo::EquippedItemClass, SpellInfo::EquippedItemInventoryTypeMask, GetAuraEffectsByType(), Player::GetBaseSpellDamageBonus(), Player::GetBaseSpellPowerBonus(), AuraEffect::GetMiscValue(), AuraEffect::GetSpellInfo(), GetStat(), GetTotalAttackPowerValue(), GetTotalAuraModifier(), GetTotalAuraModifierByMiscMask(), Object::IsPlayer(), SPELL_AURA_MOD_DAMAGE_DONE, SPELL_AURA_MOD_SPELL_DAMAGE_OF_ATTACK_POWER, SPELL_AURA_MOD_SPELL_DAMAGE_OF_STAT_PERCENT, and Object::ToPlayer().

Referenced by spell_item_wraith_scythe_drain_life::CalculateDamage(), spell_mage_ice_barrier_aura::CalculateSpellAmount(), spell_mage_ice_barrier::CalculateSpellAmount(), Spell::EffectWeaponDmg(), spell_warl_life_tap::HandleDummy(), spell_pal_seal_of_righteousness::HandleProc(), spell_sha_flametongue_weapon::HandleProc(), SpellDamageBonusDone(), lfg::LFGMgr::UpdateRaidBrowser(), and Player::UpdateSpellDamageAndHealingBonus().

◆ SpellBaseDamageBonusTaken()

int32 Unit::SpellBaseDamageBonusTaken ( SpellSchoolMask  schoolMask,
bool  isDoT = false 
)
8950{
8951 return GetTotalAuraModifier(SPELL_AURA_MOD_DAMAGE_TAKEN, [schoolMask, isDoT](AuraEffect const* aurEff)
8952 {
8953 return (aurEff->GetMiscValue() & schoolMask) != 0
8954 // Xinef: if we have DoT damage type and aura has charges, check if it affects DoTs
8955 // Xinef: required for hemorrhage & rupture / garrote
8956 && !(isDoT && aurEff->GetBase()->IsUsingCharges() && aurEff->GetSpellInfo()->ProcFlags & PROC_FLAG_TAKEN_PERIODIC);
8957 });
8958}
@ PROC_FLAG_TAKEN_PERIODIC
Definition SpellMgr.h:135
bool IsUsingCharges() const
Definition SpellAuras.h:200
uint32 ProcFlags
Definition SpellInfo.h:355

References AuraEffect::GetBase(), AuraEffect::GetMiscValue(), AuraEffect::GetSpellInfo(), GetTotalAuraModifier(), Aura::IsUsingCharges(), PROC_FLAG_TAKEN_PERIODIC, SpellInfo::ProcFlags, and SPELL_AURA_MOD_DAMAGE_TAKEN.

Referenced by spell_pal_seal_of_righteousness::HandleProc(), and SpellDamageBonusTaken().

◆ SpellBaseHealingBonusDone()

int32 Unit::SpellBaseHealingBonusDone ( SpellSchoolMask  schoolMask)
9658{
9659 int32 AdvertisedBenefit = 0;
9660
9661 AdvertisedBenefit += GetTotalAuraModifier(SPELL_AURA_MOD_HEALING_DONE, [schoolMask](AuraEffect const* aurEff)
9662 {
9663 return !aurEff->GetMiscValue() || (aurEff->GetMiscValue() & schoolMask) != 0;
9664 });
9665
9666 // Healing bonus of spirit, intellect and strength
9667 if (IsPlayer())
9668 {
9669 // Base value
9670 AdvertisedBenefit += ToPlayer()->GetBaseSpellPowerBonus();
9671 AdvertisedBenefit += ToPlayer()->GetBaseSpellHealingBonus();
9672
9673 // Healing bonus from stats
9675 for (AuraEffectList::const_iterator i = mHealingDoneOfStatPercent.begin(); i != mHealingDoneOfStatPercent.end(); ++i)
9676 {
9677 // stat used dependent from misc value (stat index)
9678 Stats usedStat = Stats((*i)->GetSpellInfo()->Effects[(*i)->GetEffIndex()].MiscValue);
9679 AdvertisedBenefit += int32(CalculatePct(GetStat(usedStat), (*i)->GetAmount()));
9680 }
9681
9682 // ... and attack power
9684 }
9685 return AdvertisedBenefit;
9686}
@ SPELL_AURA_MOD_HEALING_DONE
Definition SpellAuraDefines.h:198
@ SPELL_AURA_MOD_SPELL_HEALING_OF_STAT_PERCENT
Definition SpellAuraDefines.h:238
@ SPELL_AURA_MOD_SPELL_HEALING_OF_ATTACK_POWER
Definition SpellAuraDefines.h:301
uint32 GetBaseSpellHealingBonus()
Definition Player.h:1989

References BASE_ATTACK, CalculatePct(), GetAuraEffectsByType(), Player::GetBaseSpellHealingBonus(), Player::GetBaseSpellPowerBonus(), AuraEffect::GetMiscValue(), GetStat(), GetTotalAttackPowerValue(), GetTotalAuraModifier(), GetTotalAuraModifierByMiscMask(), Object::IsPlayer(), SPELL_AURA_MOD_HEALING_DONE, SPELL_AURA_MOD_SPELL_HEALING_OF_ATTACK_POWER, SPELL_AURA_MOD_SPELL_HEALING_OF_STAT_PERCENT, and Object::ToPlayer().

Referenced by CalculateSpellAmount(), SpellHealingBonusDone(), lfg::LFGMgr::UpdateRaidBrowser(), and Player::UpdateSpellDamageAndHealingBonus().

◆ SpellCriticalDamageBonus()

uint32 Unit::SpellCriticalDamageBonus ( Unit const *  caster,
SpellInfo const *  spellProto,
uint32  damage,
Unit const *  victim 
)
static
Todo:
: write here full calculation for melee/ranged spells
9244{
9245 // Calculate critical bonus
9246 int32 crit_bonus = damage;
9247 float crit_mod = 0.0f;
9248
9249 switch (spellProto->DmgClass)
9250 {
9251 case SPELL_DAMAGE_CLASS_MELEE: // for melee based spells is 100%
9254 crit_bonus += damage;
9255 break;
9256 default:
9257 crit_bonus += damage / 2; // for spells is 50%
9258 break;
9259 }
9260
9261 if (caster)
9262 {
9263 crit_mod += caster->GetTotalAuraModifierByMiscMask(SPELL_AURA_MOD_CRIT_DAMAGE_BONUS, spellProto->GetSchoolMask());
9264
9265 if (victim)
9266 crit_mod += caster->GetTotalAuraModifierByMiscMask(SPELL_AURA_MOD_CRIT_PERCENT_VERSUS, victim->GetCreatureTypeMask());
9267
9268 if (crit_bonus != 0 && crit_mod != 0.0f)
9269 AddPct(crit_bonus, crit_mod);
9270
9271 crit_bonus -= damage;
9272
9273 // adds additional damage to critBonus (from talents)
9274 if (Player* modOwner = caster->GetSpellModOwner())
9275 modOwner->ApplySpellMod(spellProto->Id, SPELLMOD_CRIT_DAMAGE_BONUS, crit_bonus);
9276
9277 crit_bonus += damage;
9278 }
9279
9280 return crit_bonus;
9281}

References AddPct(), SpellInfo::DmgClass, GetCreatureTypeMask(), SpellInfo::GetSchoolMask(), GetSpellModOwner(), GetTotalAuraModifierByMiscMask(), SpellInfo::Id, SPELL_AURA_MOD_CRIT_DAMAGE_BONUS, SPELL_AURA_MOD_CRIT_PERCENT_VERSUS, SPELL_DAMAGE_CLASS_MELEE, SPELL_DAMAGE_CLASS_RANGED, and SPELLMOD_CRIT_DAMAGE_BONUS.

Referenced by CalculateSpellDamageTaken(), AuraEffect::HandlePeriodicDamageAurasTick(), and AuraEffect::HandlePeriodicHealthLeechAuraTick().

◆ SpellCriticalHealingBonus()

uint32 Unit::SpellCriticalHealingBonus ( Unit const *  caster,
SpellInfo const *  spellProto,
uint32  damage,
Unit const *  victim 
)
static
Todo:
: write here full calculation for melee/ranged spells
9284{
9285 // Calculate critical bonus
9286 int32 crit_bonus;
9287 switch (spellProto->DmgClass)
9288 {
9289 case SPELL_DAMAGE_CLASS_MELEE: // for melee based spells is 100%
9292 crit_bonus = damage;
9293 break;
9294 default:
9295 crit_bonus = damage / 2; // for spells is 50%
9296 break;
9297 }
9298
9299 if (caster)
9300 {
9301 if (victim)
9302 {
9303 uint32 creatureTypeMask = victim->GetCreatureTypeMask();
9304 crit_bonus = int32(crit_bonus * caster->GetTotalAuraMultiplierByMiscMask(SPELL_AURA_MOD_CRIT_PERCENT_VERSUS, creatureTypeMask));
9305 }
9306
9307 // adds additional damage to critBonus (from talents)
9308 // xinef: used for death knight death coil
9309 if (Player* modOwner = caster->GetSpellModOwner())
9310 modOwner->ApplySpellMod(spellProto->Id, SPELLMOD_CRIT_DAMAGE_BONUS, crit_bonus);
9311 }
9312
9313 if (crit_bonus > 0)
9314 damage += crit_bonus;
9315
9316 if (caster)
9317 damage = int32(float(damage) * caster->GetTotalAuraMultiplier(SPELL_AURA_MOD_CRITICAL_HEALING_AMOUNT));
9318
9319 return damage;
9320}
@ SPELL_AURA_MOD_CRITICAL_HEALING_AMOUNT
Definition SpellAuraDefines.h:113

References SpellInfo::DmgClass, GetCreatureTypeMask(), GetSpellModOwner(), GetTotalAuraMultiplier(), GetTotalAuraMultiplierByMiscMask(), SpellInfo::Id, SPELL_AURA_MOD_CRIT_PERCENT_VERSUS, SPELL_AURA_MOD_CRITICAL_HEALING_AMOUNT, SPELL_DAMAGE_CLASS_MELEE, SPELL_DAMAGE_CLASS_RANGED, and SPELLMOD_CRIT_DAMAGE_BONUS.

Referenced by Spell::DoAllEffectOnTarget(), and AuraEffect::HandlePeriodicHealAurasTick().

◆ SpellDamageBonusDone()

uint32 Unit::SpellDamageBonusDone ( Unit victim,
SpellInfo const *  spellProto,
uint32  pdamage,
DamageEffectType  damagetype,
uint8  effIndex,
float  TotalMod = 0.0f,
uint32  stack = 1 
)
8605{
8606 if (!spellProto || !victim || damagetype == DIRECT_DAMAGE)
8607 return pdamage;
8608
8609 // Some spells don't benefit from done mods
8610 if (spellProto->HasAttribute(SPELL_ATTR3_IGNORE_CASTER_MODIFIERS))
8611 return pdamage;
8612
8613 // For totems get damage bonus from owner
8614 if (IsCreature())
8615 {
8616 if (IsTotem())
8617 {
8618 if (Unit* owner = GetOwner())
8619 return owner->SpellDamageBonusDone(victim, spellProto, pdamage, damagetype, effIndex, TotalMod, stack);
8620 }
8621 // Dancing Rune Weapon...
8622 else if (GetEntry() == 27893)
8623 {
8624 if (Unit* owner = GetOwner())
8625 return owner->SpellDamageBonusDone(victim, spellProto, pdamage, damagetype, TotalMod, stack) / 2;
8626 }
8627 }
8628
8629 // Done total percent damage auras
8630 float ApCoeffMod = 1.0f;
8631 int32 DoneTotal = 0;
8632 float DoneTotalMod = TotalMod ? TotalMod : SpellPctDamageModsDone(victim, spellProto, damagetype);
8633
8634 // Config : RATE_CREATURE_X_SPELLDAMAGE & Do Not Modify Pet/Guardian/Mind Controlled Damage
8636 DoneTotalMod *= ToCreature()->GetSpellDamageMod(ToCreature()->GetCreatureTemplate()->rank);
8637
8638 // Some spells don't benefit from pct done mods
8639 if (!spellProto->HasAttribute(SPELL_ATTR6_IGNORE_CASTER_DAMAGE_MODIFIERS))
8640 {
8641 uint32 creatureTypeMask = victim->GetCreatureTypeMask();
8642 // Add flat bonus from spell damage versus
8644 }
8645
8646 // done scripted mod (take it from owner)
8647 Unit* owner = GetOwner() ? GetOwner() : this;
8648 int32 DoneAdvertisedBenefit = 0;
8649 DoneAdvertisedBenefit += owner->GetTotalAuraModifier(SPELL_AURA_OVERRIDE_CLASS_SCRIPTS, [spellProto](AuraEffect const* aurEff)
8650 {
8651 if (!aurEff->IsAffectedOnSpell(spellProto))
8652 return false;
8653
8654 switch (aurEff->GetMiscValue())
8655 {
8656 case 4418: // Increased Shock Damage
8657 case 4554: // Increased Lightning Damage
8658 case 4555: // Improved Moonfire
8659 case 5142: // Increased Lightning Damage
8660 case 5147: // Improved Consecration / Libram of Resurgence
8661 case 5148: // Idol of the Shooting Star
8662 case 6008: // Increased Lightning Damage
8663 case 8627: // Totem of Hex
8664 return true;
8665 break;
8666 default:
8667 break;
8668 }
8669
8670 return false;
8671 });
8672
8673 // Custom scripted damage
8674 switch (spellProto->SpellFamilyName)
8675 {
8676 case SPELLFAMILY_DRUID:
8677 {
8678 // Nourish vs Idol of the Flourishing Life
8679 if (spellProto->SpellFamilyFlags[1] & 0x02000000)
8680 {
8681 if (AuraEffect const* relicAurEff = GetAuraEffect(64949, EFFECT_0))
8682 {
8683 DoneAdvertisedBenefit += relicAurEff->GetAmount();
8684 }
8685 }
8686 break;
8687 }
8689 {
8690 // Sigil of the Vengeful Heart
8691 if (spellProto->SpellFamilyFlags[0] & 0x2000)
8692 {
8693 if (AuraEffect* aurEff = GetAuraEffect(64962, EFFECT_1))
8694 {
8695 AddPct(DoneTotal, aurEff->GetAmount());
8696 }
8697 }
8698
8699 // Impurity
8701 {
8702 AddPct(ApCoeffMod, aurEff->GetAmount());
8703 }
8704
8705 // Blood Boil - bonus for diseased targets
8706 if ((spellProto->SpellFamilyFlags[0] & 0x00040000) && victim->GetAuraEffect(SPELL_AURA_PERIODIC_DAMAGE, SPELLFAMILY_DEATHKNIGHT, 0, 0, 0x00000002, GetGUID()))
8707 {
8708 DoneTotal += 95;
8709 ApCoeffMod = 1.5835f;
8710 }
8711 break;
8712 }
8713 default:
8714 break;
8715 }
8716
8717 // Done fixed damage bonus auras
8718 DoneAdvertisedBenefit += SpellBaseDamageBonusDone(spellProto->GetSchoolMask());
8719
8720 // Check for table values
8721 float coeff = spellProto->Effects[effIndex].BonusMultiplier;
8722 SpellBonusEntry const* bonus = sSpellMgr->GetSpellBonusData(spellProto->Id);
8723 if (bonus)
8724 {
8725 if (damagetype == DOT)
8726 {
8727 coeff = bonus->dot_damage;
8728 if (bonus->ap_dot_bonus > 0)
8729 {
8730 WeaponAttackType attType = (spellProto->IsRangedWeaponSpell() && spellProto->DmgClass != SPELL_DAMAGE_CLASS_MELEE) ? RANGED_ATTACK : BASE_ATTACK;
8732 APbonus += GetTotalAttackPowerValue(attType);
8733 DoneTotal += int32(bonus->ap_dot_bonus * stack * ApCoeffMod * APbonus);
8734 }
8735 }
8736 else
8737 {
8738 coeff = bonus->direct_damage;
8739 if (bonus->ap_bonus > 0)
8740 {
8741 WeaponAttackType attType = (spellProto->IsRangedWeaponSpell() && spellProto->DmgClass != SPELL_DAMAGE_CLASS_MELEE) ? RANGED_ATTACK : BASE_ATTACK;
8743 APbonus += GetTotalAttackPowerValue(attType);
8744 DoneTotal += int32(bonus->ap_bonus * stack * ApCoeffMod * APbonus);
8745 }
8746 }
8747 }
8748
8749 // Default calculation
8750 if (coeff && DoneAdvertisedBenefit)
8751 {
8752 float factorMod = CalculateLevelPenalty(spellProto) * stack;
8753
8754 if (Player* modOwner = GetSpellModOwner())
8755 {
8756 coeff *= 100.0f;
8757 modOwner->ApplySpellMod(spellProto->Id, SPELLMOD_BONUS_MULTIPLIER, coeff);
8758 coeff /= 100.0f;
8759 }
8760
8761 DoneTotal += int32(DoneAdvertisedBenefit * coeff * factorMod);
8762 }
8763
8764 float tmpDamage = (float(pdamage) + DoneTotal) * DoneTotalMod;
8765 // apply spellmod to Done damage (flat and pct)
8766 if (Player* modOwner = GetSpellModOwner())
8767 modOwner->ApplySpellMod(spellProto->Id, damagetype == DOT ? SPELLMOD_DOT : SPELLMOD_DAMAGE, tmpDamage);
8768
8769 return uint32(std::max(tmpDamage, 0.0f));
8770}
@ EFFECT_1
Definition SharedDefines.h:32
@ SPELL_ATTR6_IGNORE_CASTER_DAMAGE_MODIFIERS
Definition SharedDefines.h:644
@ SPELL_AURA_MOD_FLAT_SPELL_DAMAGE_VERSUS
Definition SpellAuraDefines.h:243
@ SPELLMOD_DOT
Definition SpellDefines.h:98
@ SPELLMOD_BONUS_MULTIPLIER
Definition SpellDefines.h:100
float GetSpellDamageMod(int32 Rank)
Definition Creature.cpp:1572
float SpellPctDamageModsDone(Unit *victim, SpellInfo const *spellProto, DamageEffectType damagetype)
Definition Unit.cpp:8276
int32 SpellBaseDamageBonusDone(SpellSchoolMask schoolMask)
Definition Unit.cpp:8915
float CalculateLevelPenalty(SpellInfo const *spellProto) const
Definition Unit.cpp:3170
Definition SpellMgr.h:318
float ap_dot_bonus
Definition SpellMgr.h:322
float dot_damage
Definition SpellMgr.h:320
float ap_bonus
Definition SpellMgr.h:321
float direct_damage
Definition SpellMgr.h:319

References AddPct(), SpellBonusEntry::ap_bonus, SpellBonusEntry::ap_dot_bonus, BASE_ATTACK, CalculateLevelPenalty(), DIRECT_DAMAGE, SpellBonusEntry::direct_damage, SpellInfo::DmgClass, DOT, SpellBonusEntry::dot_damage, EFFECT_0, EFFECT_1, SpellInfo::Effects, AuraEffect::GetAmount(), GetAuraEffect(), GetCreatureTypeMask(), GetDummyAuraEffect(), Object::GetEntry(), Object::GetGUID(), AuraEffect::GetMiscValue(), GetOwner(), SpellInfo::GetSchoolMask(), Creature::GetSpellDamageMod(), GetSpellModOwner(), GetTotalAttackPowerValue(), GetTotalAuraModifier(), GetTotalAuraModifierByMiscMask(), SpellInfo::HasAttribute(), SpellInfo::Id, AuraEffect::IsAffectedOnSpell(), IsControlledByPlayer(), Object::IsCreature(), IsGuardian(), IsPet(), SpellInfo::IsRangedWeaponSpell(), IsTotem(), RANGED_ATTACK, SPELL_ATTR3_IGNORE_CASTER_MODIFIERS, SPELL_ATTR6_IGNORE_CASTER_DAMAGE_MODIFIERS, SPELL_AURA_MELEE_ATTACK_POWER_ATTACKER_BONUS, SPELL_AURA_MOD_FLAT_SPELL_DAMAGE_VERSUS, SPELL_AURA_OVERRIDE_CLASS_SCRIPTS, SPELL_AURA_PERIODIC_DAMAGE, SPELL_AURA_RANGED_ATTACK_POWER_ATTACKER_BONUS, SPELL_DAMAGE_CLASS_MELEE, SpellBaseDamageBonusDone(), SPELLFAMILY_DEATHKNIGHT, SPELLFAMILY_DRUID, SpellInfo::SpellFamilyFlags, SpellInfo::SpellFamilyName, SPELLMOD_BONUS_MULTIPLIER, SPELLMOD_DAMAGE, SPELLMOD_DOT, SpellPctDamageModsDone(), sSpellMgr, and Object::ToCreature().

Referenced by spell_warl_seed_of_corruption_aura::CalculateAmount(), AuraEffect::CalculateAmount(), spell_warl_seed_of_corruption_dummy::CalculateBuffer(), Spell::EffectHealthLeech(), Spell::EffectPowerDrain(), Spell::EffectSchoolDMG(), spell_warr_bloodthirst::HandleDamage(), AuraEffect::HandlePeriodicDamageAurasTick(), AuraEffect::HandlePeriodicHealthLeechAuraTick(), and AuraEffect::HandleProcTriggerDamageAuraProc().

◆ SpellDamageBonusTaken()

uint32 Unit::SpellDamageBonusTaken ( Unit caster,
SpellInfo const *  spellProto,
uint32  pdamage,
DamageEffectType  damagetype,
uint32  stack = 1 
)
8773{
8774 if (!spellProto || damagetype == DIRECT_DAMAGE)
8775 return pdamage;
8776
8777 int32 TakenTotal = 0;
8778 float TakenTotalMod = 1.0f;
8779
8780 // from positive and negative SPELL_AURA_MOD_DAMAGE_PERCENT_TAKEN
8781 // multiplicative bonus, for example Dispersion + Shadowform (0.10*0.85=0.085)
8782 TakenTotalMod *= GetTotalAuraMultiplierByMiscMask(SPELL_AURA_MOD_DAMAGE_PERCENT_TAKEN, spellProto->GetSchoolMask());
8783
8784 TakenTotalMod = processDummyAuras(TakenTotalMod);
8785
8786 // From caster spells
8787 if (caster)
8788 {
8789 TakenTotalMod *= GetTotalAuraMultiplier(SPELL_AURA_MOD_DAMAGE_FROM_CASTER, [caster, spellProto](AuraEffect const* aurEff) -> bool
8790 {
8791 if (aurEff->GetCasterGUID() == caster->GetGUID() && aurEff->IsAffectedOnSpell(spellProto))
8792 return true;
8793 return false;
8794 });
8795 }
8796
8797 if (uint32 mechanicMask = spellProto->GetAllEffectsMechanicMask())
8798 {
8799 int32 modifierMax = 0;
8800 int32 modifierMin = 0;
8802 for (AuraEffectList::const_iterator i = auraEffectList.begin(); i != auraEffectList.end(); ++i)
8803 {
8804 if (!spellProto->ValidateAttribute6SpellDamageMods(caster, *i, damagetype == DOT))
8805 continue;
8806
8807 // Only death knight spell with this aura
8808 if ((*i)->GetSpellInfo()->SpellFamilyName == SPELLFAMILY_DEATHKNIGHT)
8809 if (!caster || caster->GetGUID() != (*i)->GetCasterGUID())
8810 continue;
8811
8812 if (mechanicMask & uint32(1 << (*i)->GetMiscValue()))
8813 {
8814 if ((*i)->GetAmount() > 0)
8815 {
8816 if ((*i)->GetAmount() > modifierMax)
8817 modifierMax = (*i)->GetAmount();
8818 }
8819 else if ((*i)->GetAmount() < modifierMin)
8820 modifierMin = (*i)->GetAmount();
8821 }
8822 }
8823
8824 AddPct(TakenTotalMod, modifierMax);
8825 AddPct(TakenTotalMod, modifierMin);
8826 }
8827
8828 int32 TakenAdvertisedBenefit = SpellBaseDamageBonusTaken(spellProto->GetSchoolMask(), damagetype == DOT);
8829
8830 // Check for table values
8831 float coeff = 0;
8832 SpellBonusEntry const* bonus = sSpellMgr->GetSpellBonusData(spellProto->Id);
8833 if (bonus)
8834 coeff = (damagetype == DOT) ? bonus->dot_damage : bonus->direct_damage;
8835
8836 // Default calculation
8837 if (TakenAdvertisedBenefit)
8838 {
8839 if (coeff <= 0.0f)
8840 {
8841 if (caster)
8842 coeff = caster->CalculateDefaultCoefficient(spellProto, damagetype) * int32(stack);
8843 else
8844 coeff = CalculateDefaultCoefficient(spellProto, damagetype) * int32(stack);
8845 }
8846
8847 float factorMod = CalculateLevelPenalty(spellProto) * stack;
8848 TakenTotal += int32(TakenAdvertisedBenefit * coeff * factorMod);
8849 }
8850
8851 // No positive taken bonus, custom attr
8852 if (spellProto->HasAttribute(SPELL_ATTR0_CU_NO_POSITIVE_TAKEN_BONUS) && TakenTotalMod > 1.0f)
8853 {
8854 TakenTotal = 0;
8855 TakenTotalMod = 1.0f;
8856 }
8857
8858 // xinef: sanctified wrath talent
8859 if (caster && TakenTotalMod < 1.0f && caster->HasIgnoreTargetResistAura())
8860 {
8861 float ignoreModifier = 1.0f - TakenTotalMod;
8862 bool addModifier = false;
8864 for (AuraEffectList::const_iterator j = ResIgnoreAuras.begin(); j != ResIgnoreAuras.end(); ++j)
8865 if ((*j)->GetMiscValue() & spellProto->SchoolMask)
8866 {
8867 ApplyPct(ignoreModifier, (*j)->GetAmount());
8868 addModifier = true;
8869 }
8870
8871 if (addModifier)
8872 TakenTotalMod += ignoreModifier;
8873 }
8874
8875 float tmpDamage = (float(pdamage) + TakenTotal) * TakenTotalMod;
8876
8877 return uint32(std::max(tmpDamage, 0.0f));
8878}
float CalculateDefaultCoefficient(SpellInfo const *spellInfo, DamageEffectType damagetype) const
Definition Unit.cpp:13710
int32 SpellBaseDamageBonusTaken(SpellSchoolMask schoolMask, bool isDoT=false)
Definition Unit.cpp:8949

References AddPct(), ApplyPct(), CalculateDefaultCoefficient(), CalculateLevelPenalty(), DIRECT_DAMAGE, SpellBonusEntry::direct_damage, DOT, SpellBonusEntry::dot_damage, SpellInfo::GetAllEffectsMechanicMask(), GetAuraEffectsByType(), AuraEffect::GetCasterGUID(), Object::GetGUID(), SpellInfo::GetSchoolMask(), GetTotalAuraMultiplier(), GetTotalAuraMultiplierByMiscMask(), SpellInfo::HasAttribute(), HasIgnoreTargetResistAura(), SpellInfo::Id, AuraEffect::IsAffectedOnSpell(), processDummyAuras(), SpellInfo::SchoolMask, SPELL_ATTR0_CU_NO_POSITIVE_TAKEN_BONUS, SPELL_AURA_MOD_DAMAGE_FROM_CASTER, SPELL_AURA_MOD_DAMAGE_PERCENT_TAKEN, SPELL_AURA_MOD_IGNORE_TARGET_RESIST, SPELL_AURA_MOD_MECHANIC_DAMAGE_TAKEN_PERCENT, SpellBaseDamageBonusTaken(), SPELLFAMILY_DEATHKNIGHT, sSpellMgr, and SpellInfo::ValidateAttribute6SpellDamageMods().

Referenced by DealDamageShieldDamage(), Spell::EffectHealthLeech(), Spell::EffectPowerDrain(), Spell::EffectSchoolDMG(), Aura::HandleAuraSpecificMods(), AuraEffect::HandlePeriodicDamageAurasTick(), AuraEffect::HandlePeriodicHealthLeechAuraTick(), AuraEffect::HandleProcTriggerDamageAuraProc(), and spell_black_temple_l5_arcane_charge::PrepareSpellScript().

◆ SpellDoneCritChance()

float Unit::SpellDoneCritChance ( Unit const *  ,
SpellInfo const *  spellProto,
SpellSchoolMask  schoolMask,
WeaponAttackType  attackType,
bool  skipEffectCheck 
) const
8961{
8962 // Mobs can't crit with spells.
8963 if (IsCreature() && !GetSpellModOwner())
8964 return -100.0f;
8965
8966 // not critting spell
8967 if (spellProto->HasAttribute(SPELL_ATTR2_CANT_CRIT))
8968 return 0.0f;
8969
8970 // Xinef: check if spell is capable of critting, auras requires special aura to crit so they can be skipped
8971 if (!skipEffectCheck && !spellProto->IsCritCapable())
8972 return 0.0f;
8973
8974 float crit_chance = 0.0f;
8975 switch (spellProto->DmgClass)
8976 {
8978 {
8979 if (schoolMask & SPELL_SCHOOL_MASK_NORMAL)
8980 crit_chance = 0.0f;
8981 // For other schools
8982 else if (IsPlayer())
8983 crit_chance = GetFloatValue(static_cast<uint16>(PLAYER_SPELL_CRIT_PERCENTAGE1) + GetFirstSchoolInMask(schoolMask));
8984 else
8985 {
8986 crit_chance = (float)m_baseSpellCritChance;
8988 }
8989 break;
8990 }
8993 {
8994 if (IsPlayer())
8995 {
8996 switch (attackType)
8997 {
8998 case BASE_ATTACK:
9000 break;
9001 case OFF_ATTACK:
9003 break;
9004 case RANGED_ATTACK:
9006 break;
9007 default:
9008 break;
9009 }
9010 }
9011 else
9012 {
9013 crit_chance = 5.0f;
9016 }
9018 break;
9019 }
9020 // values overridden in spellmgr for lifebloom and earth shield
9022 default:
9023 return 0.0f;
9024 }
9025
9026 // percent done
9027 // only players use intelligence for critical chance computations
9028 if (Player* modOwner = GetSpellModOwner())
9029 modOwner->ApplySpellMod(spellProto->Id, SPELLMOD_CRITICAL_CHANCE, crit_chance);
9030
9031 // xinef: can be negative!
9032 return crit_chance;
9033}
@ SPELL_ATTR2_CANT_CRIT
Definition SharedDefines.h:496
@ SPELL_AURA_MOD_SPELL_CRIT_CHANCE_SCHOOL
Definition SpellAuraDefines.h:134
@ SPELLMOD_CRITICAL_CHANCE
Definition SpellDefines.h:83
@ PLAYER_SPELL_CRIT_PERCENTAGE1
Definition UpdateFields.h:354

References BASE_ATTACK, SpellInfo::DmgClass, GetFirstSchoolInMask(), Object::GetFloatValue(), GetSpellModOwner(), GetTotalAuraModifier(), GetTotalAuraModifierByMiscMask(), SpellInfo::HasAttribute(), SpellInfo::Id, Object::IsCreature(), SpellInfo::IsCritCapable(), Object::IsPlayer(), m_baseSpellCritChance, OFF_ATTACK, PLAYER_CRIT_PERCENTAGE, PLAYER_OFFHAND_CRIT_PERCENTAGE, PLAYER_RANGED_CRIT_PERCENTAGE, PLAYER_SPELL_CRIT_PERCENTAGE1, RANGED_ATTACK, SPELL_ATTR2_CANT_CRIT, SPELL_AURA_MOD_CRIT_PCT, SPELL_AURA_MOD_SPELL_CRIT_CHANCE_SCHOOL, SPELL_AURA_MOD_WEAPON_CRIT_PERCENT, SPELL_DAMAGE_CLASS_MAGIC, SPELL_DAMAGE_CLASS_MELEE, SPELL_DAMAGE_CLASS_NONE, SPELL_DAMAGE_CLASS_RANGED, SPELL_SCHOOL_MASK_NORMAL, and SPELLMOD_CRITICAL_CHANCE.

Referenced by Spell::DoAllEffectOnLaunchTarget().

◆ SpellHealingBonusDone()

uint32 Unit::SpellHealingBonusDone ( Unit victim,
SpellInfo const *  spellProto,
uint32  healamount,
DamageEffectType  damagetype,
uint8  effIndex,
float  TotalMod = 0.0f,
uint32  stack = 1 
)
9408{
9409 // For totems get healing bonus from owner (statue isn't totem in fact)
9410 if (IsCreature() && IsTotem())
9411 if (Unit* owner = GetOwner())
9412 return owner->SpellHealingBonusDone(victim, spellProto, healamount, damagetype, effIndex, TotalMod, stack);
9413
9414 // No bonus healing for potion spells
9415 if (spellProto->SpellFamilyName == SPELLFAMILY_POTION)
9416 return healamount;
9417
9418 float ApCoeffMod = 1.0f;
9419 float DoneTotalMod = TotalMod ? TotalMod : SpellPctHealingModsDone(victim, spellProto, damagetype);
9420 int32 DoneTotal = 0;
9421
9422 // done scripted mod (take it from owner)
9423 Unit* owner = GetOwner() ? GetOwner() : this;
9424 int32 DoneAdvertisedBenefit = 0;
9425 AuraEffectList const& mOverrideClassScript = owner->GetAuraEffectsByType(SPELL_AURA_OVERRIDE_CLASS_SCRIPTS);
9426 for (AuraEffectList::const_iterator i = mOverrideClassScript.begin(); i != mOverrideClassScript.end(); ++i)
9427 {
9428 if (!(*i)->IsAffectedOnSpell(spellProto))
9429 continue;
9430
9431 switch ((*i)->GetMiscValue())
9432 {
9433 case 4415: // Increased Rejuvenation Healing
9434 case 4953:
9435 DoneAdvertisedBenefit += (*i)->GetAmount();
9436 break;
9437 case 3736: // Hateful Totem of the Third Wind / Increased Lesser Healing Wave / LK Arena (4/5/6) Totem of the Third Wind / Savage Totem of the Third Wind
9438 DoneAdvertisedBenefit += (*i)->GetAmount();
9439 break;
9440 }
9441 }
9442
9443 switch (spellProto->SpellFamilyName)
9444 {
9446 {
9447 // Impurity
9449 {
9450 AddPct(ApCoeffMod, aurEff->GetAmount());
9451 }
9452 break;
9453 }
9454 default:
9455 break;
9456 }
9457
9458 // Done fixed damage bonus auras
9459 DoneAdvertisedBenefit += SpellBaseHealingBonusDone(spellProto->GetSchoolMask());
9460 float coeff = spellProto->Effects[effIndex].BonusMultiplier;
9461
9462 // Check for table values
9463 SpellBonusEntry const* bonus = sSpellMgr->GetSpellBonusData(spellProto->Id);
9464 if (bonus)
9465 {
9466 if (damagetype == DOT)
9467 {
9468 coeff = bonus->dot_damage;
9469 if (bonus->ap_dot_bonus > 0)
9470 DoneTotal += int32(bonus->ap_dot_bonus * ApCoeffMod * stack * GetTotalAttackPowerValue(
9471 (spellProto->IsRangedWeaponSpell() && spellProto->DmgClass != SPELL_DAMAGE_CLASS_MELEE) ? RANGED_ATTACK : BASE_ATTACK));
9472 }
9473 else
9474 {
9475 coeff = bonus->direct_damage;
9476 if (bonus->ap_bonus > 0)
9477 DoneTotal += int32(bonus->ap_bonus * ApCoeffMod * stack * GetTotalAttackPowerValue(
9478 (spellProto->IsRangedWeaponSpell() && spellProto->DmgClass != SPELL_DAMAGE_CLASS_MELEE) ? RANGED_ATTACK : BASE_ATTACK));
9479 }
9480 }
9481 else
9482 {
9483 // No bonus healing for SPELL_DAMAGE_CLASS_NONE class spells by default
9484 if (spellProto->DmgClass == SPELL_DAMAGE_CLASS_NONE)
9485 return healamount;
9486 }
9487
9488 // Default calculation
9489 if (DoneAdvertisedBenefit)
9490 {
9491 float factorMod = CalculateLevelPenalty(spellProto) * stack;
9492 if (Player* modOwner = GetSpellModOwner())
9493 {
9494 coeff *= 100.0f;
9495 modOwner->ApplySpellMod(spellProto->Id, SPELLMOD_BONUS_MULTIPLIER, coeff);
9496 coeff /= 100.0f;
9497 }
9498 DoneTotal += int32(DoneAdvertisedBenefit * coeff * factorMod);
9499 }
9500
9501 for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
9502 {
9503 switch (spellProto->Effects[i].ApplyAuraName)
9504 {
9505 // Bonus healing does not apply to these spells
9508 DoneTotal = 0;
9509 break;
9510 default:
9511 break;
9512 }
9513 if (spellProto->Effects[i].Effect == SPELL_EFFECT_HEALTH_LEECH)
9514 DoneTotal = 0;
9515 }
9516
9517 // use float as more appropriate for negative values and percent applying
9518 float heal = float(int32(healamount) + DoneTotal) * DoneTotalMod;
9519 // apply spellmod to Done amount
9520
9521 if (Player* modOwner = GetSpellModOwner())
9522 modOwner->ApplySpellMod(spellProto->Id, damagetype == DOT ? SPELLMOD_DOT : SPELLMOD_DAMAGE, heal);
9523
9524 return uint32(std::max(heal, 0.0f));
9525}
@ SPELLFAMILY_POTION
Definition SharedDefines.h:3797
@ SPELL_AURA_PERIODIC_HEALTH_FUNNEL
Definition SpellAuraDefines.h:125
int32 SpellBaseHealingBonusDone(SpellSchoolMask schoolMask)
Definition Unit.cpp:9657
float SpellPctHealingModsDone(Unit *victim, SpellInfo const *spellProto, DamageEffectType damagetype)
Definition Unit.cpp:9322

References AddPct(), SpellBonusEntry::ap_bonus, SpellBonusEntry::ap_dot_bonus, BASE_ATTACK, CalculateLevelPenalty(), SpellBonusEntry::direct_damage, SpellInfo::DmgClass, DOT, SpellBonusEntry::dot_damage, SpellInfo::Effects, GetAuraEffectsByType(), GetDummyAuraEffect(), GetOwner(), SpellInfo::GetSchoolMask(), GetSpellModOwner(), GetTotalAttackPowerValue(), SpellInfo::Id, Object::IsCreature(), SpellInfo::IsRangedWeaponSpell(), IsTotem(), MAX_SPELL_EFFECTS, RANGED_ATTACK, SPELL_AURA_OVERRIDE_CLASS_SCRIPTS, SPELL_AURA_PERIODIC_HEALTH_FUNNEL, SPELL_AURA_PERIODIC_LEECH, SPELL_DAMAGE_CLASS_MELEE, SPELL_DAMAGE_CLASS_NONE, SPELL_EFFECT_HEALTH_LEECH, SpellBaseHealingBonusDone(), SPELLFAMILY_DEATHKNIGHT, SPELLFAMILY_POTION, SpellInfo::SpellFamilyName, SPELLMOD_BONUS_MULTIPLIER, SPELLMOD_DAMAGE, SPELLMOD_DOT, SpellPctHealingModsDone(), and sSpellMgr.

Referenced by AuraEffect::CalculateAmount(), Spell::DoAllEffectOnTarget(), Spell::EffectHeal(), Spell::EffectHealMechanical(), Spell::EffectHealPct(), spell_dru_lifebloom::HandleDispel(), AuraEffect::HandlePeriodicHealAurasTick(), and AuraEffect::HandlePeriodicHealthLeechAuraTick().

◆ SpellHealingBonusTaken()

uint32 Unit::SpellHealingBonusTaken ( Unit caster,
SpellInfo const *  spellProto,
uint32  healamount,
DamageEffectType  damagetype,
uint32  stack = 1 
)
9528{
9529 float TakenTotalMod = 1.0f;
9530 float minval = 0.0f;
9531
9532 // Healing taken percent
9533 if (!sScriptMgr->OnSpellHealingBonusTakenNegativeModifiers(this, caster, spellProto, minval))
9534 {
9536 }
9537
9538 if (minval)
9539 AddPct(TakenTotalMod, minval);
9540
9542 if (maxval)
9543 AddPct(TakenTotalMod, maxval);
9544
9545 // Tenacity increase healing % taken
9546 if (AuraEffect const* Tenacity = GetAuraEffect(58549, 0))
9547 AddPct(TakenTotalMod, Tenacity->GetAmount());
9548
9549 // Healing Done
9550 int32 TakenTotal = 0;
9551
9552 // Taken fixed damage bonus auras
9553 int32 TakenAdvertisedBenefit = GetTotalAuraModifierByMiscMask(SPELL_AURA_MOD_HEALING, spellProto->GetSchoolMask());
9554
9555 // Nourish cast - 20% bonus if target has Rejuvenation, Regrowth, Lifebloom, or Wild Growth from caster
9556 // Glyph of Nourish is handled by spell_dru_nourish script
9557 if (spellProto->SpellFamilyName == SPELLFAMILY_DRUID && spellProto->SpellFamilyFlags[1] & 0x2000000 && caster)
9558 {
9560 for (AuraEffectList::const_iterator i = auras.begin(); i != auras.end(); ++i)
9561 {
9562 if ((*i)->GetCasterGUID() == caster->GetGUID())
9563 {
9564 SpellInfo const* spell = (*i)->GetSpellInfo();
9565 // Rejuvenation, Regrowth, Lifebloom, or Wild Growth
9566 if (spell->SpellFamilyFlags.HasFlag(0x50, 0x4000010, 0))
9567 {
9568 TakenTotalMod *= 1.2f;
9569 break;
9570 }
9571 }
9572 }
9573 }
9574
9575 if (damagetype == DOT)
9576 {
9577 // Healing over time taken percent
9578 float minval_hot = float(GetMaxNegativeAuraModifier(SPELL_AURA_MOD_HOT_PCT));
9579 if (minval_hot)
9580 AddPct(TakenTotalMod, minval_hot);
9581
9582 float maxval_hot = float(GetMaxPositiveAuraModifier(SPELL_AURA_MOD_HOT_PCT));
9583 if (maxval_hot)
9584 AddPct(TakenTotalMod, maxval_hot);
9585 }
9586
9587 // Check for table values
9588 SpellBonusEntry const* bonus = sSpellMgr->GetSpellBonusData(spellProto->Id);
9589 float coeff = 0;
9590 float factorMod = 1.0f;
9591 if (bonus)
9592 coeff = (damagetype == DOT) ? bonus->dot_damage : bonus->direct_damage;
9593 else
9594 {
9595 // No bonus healing for SPELL_DAMAGE_CLASS_NONE class spells by default
9596 if (spellProto->DmgClass == SPELL_DAMAGE_CLASS_NONE)
9597 {
9598 healamount = uint32(std::max((float(healamount) * TakenTotalMod), 0.0f));
9599 return healamount;
9600 }
9601 }
9602
9603 // Default calculation
9604 if (TakenAdvertisedBenefit)
9605 {
9606 float TakenCoeff = 0.0f;
9607 if (coeff <= 0)
9608 coeff = CalculateDefaultCoefficient(spellProto, damagetype) * int32(stack) * 1.88f; // As wowwiki says: C = (Cast Time / 3.5) * 1.88 (for healing spells)
9609
9610 factorMod *= CalculateLevelPenalty(spellProto) * int32(stack);
9611 if (Player* modOwner = GetSpellModOwner())
9612 {
9613 coeff *= 100.0f;
9614 modOwner->ApplySpellMod(spellProto->Id, SPELLMOD_BONUS_MULTIPLIER, coeff);
9615 coeff /= 100.0f;
9616 }
9617
9618 TakenTotal += int32(TakenAdvertisedBenefit * (coeff > 0 ? coeff : TakenCoeff) * factorMod);
9619 }
9620
9621 if (caster)
9622 {
9623 TakenTotalMod *= GetTotalAuraMultiplier(SPELL_AURA_MOD_HEALING_RECEIVED, [caster, spellProto](AuraEffect const* aurEff)
9624 {
9625 return caster->GetGUID() == aurEff->GetCasterGUID() && aurEff->IsAffectedOnSpell(spellProto);
9626 });
9627 }
9628
9629 for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
9630 {
9631 switch (spellProto->Effects[i].ApplyAuraName)
9632 {
9633 // Bonus healing does not apply to these spells
9636 TakenTotal = 0;
9637 break;
9638 default:
9639 break;
9640 }
9641 if (spellProto->Effects[i].Effect == SPELL_EFFECT_HEALTH_LEECH)
9642 TakenTotal = 0;
9643 }
9644
9645 // No positive taken bonus, custom attr
9646 if ((spellProto->HasAttribute(SPELL_ATTR6_IGNORE_HEALTH_MODIFIERS) || spellProto->HasAttribute(SPELL_ATTR0_CU_NO_POSITIVE_TAKEN_BONUS)) && TakenTotalMod > 1.0f)
9647 {
9648 TakenTotal = 0;
9649 TakenTotalMod = 1.0f;
9650 }
9651
9652 float heal = float(int32(healamount) + TakenTotal) * TakenTotalMod;
9653
9654 return uint32(std::max(heal, 0.0f));
9655}
@ SPELL_ATTR6_IGNORE_HEALTH_MODIFIERS
Definition SharedDefines.h:642
@ SPELL_AURA_MOD_HEALING_RECEIVED
Definition SpellAuraDefines.h:346
@ SPELL_AURA_MOD_HEALING_PCT
Definition SpellAuraDefines.h:181
@ SPELL_AURA_MOD_HOT_PCT
Definition SpellAuraDefines.h:322
@ SPELL_AURA_MOD_HEALING
Definition SpellAuraDefines.h:178

References AddPct(), CalculateDefaultCoefficient(), CalculateLevelPenalty(), SpellBonusEntry::direct_damage, SpellInfo::DmgClass, DOT, SpellBonusEntry::dot_damage, SpellInfo::Effects, GetAuraEffect(), GetAuraEffectsByType(), AuraEffect::GetCasterGUID(), Object::GetGUID(), GetMaxNegativeAuraModifier(), GetMaxPositiveAuraModifier(), SpellInfo::GetSchoolMask(), GetSpellModOwner(), GetTotalAuraModifierByMiscMask(), GetTotalAuraMultiplier(), SpellInfo::HasAttribute(), flag96::HasFlag(), SpellInfo::Id, AuraEffect::IsAffectedOnSpell(), MAX_SPELL_EFFECTS, SPELL_ATTR0_CU_NO_POSITIVE_TAKEN_BONUS, SPELL_ATTR6_IGNORE_HEALTH_MODIFIERS, SPELL_AURA_MOD_HEALING, SPELL_AURA_MOD_HEALING_PCT, SPELL_AURA_MOD_HEALING_RECEIVED, SPELL_AURA_MOD_HOT_PCT, SPELL_AURA_PERIODIC_HEAL, SPELL_AURA_PERIODIC_HEALTH_FUNNEL, SPELL_AURA_PERIODIC_LEECH, SPELL_DAMAGE_CLASS_NONE, SPELL_EFFECT_HEALTH_LEECH, SPELLFAMILY_DRUID, SpellInfo::SpellFamilyFlags, SpellInfo::SpellFamilyName, SPELLMOD_BONUS_MULTIPLIER, sScriptMgr, and sSpellMgr.

Referenced by spell_dru_lifebloom::AfterRemove(), Spell::DoAllEffectOnTarget(), Spell::EffectHeal(), Spell::EffectHealMechanical(), Spell::EffectHealPct(), spell_pri_renew::HandleApplyEffect(), Aura::HandleAuraSpecificMods(), spell_pal_lay_on_hands::HandleMaxHealthHeal(), AuraEffect::HandlePeriodicHealAurasTick(), and AuraEffect::HandlePeriodicHealthLeechAuraTick().

◆ SpellHitResult() [1/2]

SpellMissInfo Unit::SpellHitResult ( Unit victim,
Spell const *  spell,
bool  canReflect = false 
)
Todo:
: client not show miss log for this spells - so need find info for this in dbc and use it!
3664{
3665 SpellInfo const* spellInfo = spell->GetSpellInfo();
3666
3667 // Check for immune
3668 if (victim->IsImmunedToSpell(spellInfo, spell))
3669 {
3670 return SPELL_MISS_IMMUNE;
3671 }
3672
3673 // All positive spells can`t miss
3675 if ((spellInfo->IsPositive() || spellInfo->HasEffect(SPELL_EFFECT_DISPEL))
3676 && (!IsHostileTo(victim))) // prevent from affecting enemy by "positive" spell
3677 {
3678 return SPELL_MISS_NONE;
3679 }
3680
3681 // Check for immune
3682 // xinef: check for school immunity only
3683 if (victim->IsImmunedToSchool(spell))
3684 {
3685 return SPELL_MISS_IMMUNE;
3686 }
3687
3688 if (this == victim)
3689 {
3690 return SPELL_MISS_NONE;
3691 }
3692
3693 // Return evade for units in evade mode
3694 if (victim->IsCreature() && victim->ToCreature()->IsEvadingAttacks() && !spellInfo->HasAura(SPELL_AURA_CONTROL_VEHICLE) &&
3696 {
3697 return SPELL_MISS_EVADE;
3698 }
3699
3700 // Try victim reflect spell
3701 if (CanReflect)
3702 {
3703 int32 reflectchance = victim->GetTotalAuraModifier(SPELL_AURA_REFLECT_SPELLS);
3705
3706 if (reflectchance > 0 && roll_chance_i(reflectchance))
3707 {
3708 // Start triggers for remove charges if need (trigger only for victim, and mark as active spell)
3709 //ProcSkillsAndAuras(victim, PROC_FLAG_NONE, PROC_FLAG_TAKEN_SPELL_MAGIC_DMG_CLASS_NEG, PROC_EX_REFLECT, 1, BASE_ATTACK, spell);
3710 return SPELL_MISS_REFLECT;
3711 }
3712 }
3713
3714 switch (spellInfo->DmgClass)
3715 {
3718 return MeleeSpellHitResult(victim, spellInfo);
3720 {
3721 if (spellInfo->SpellFamilyName)
3722 {
3723 return SPELL_MISS_NONE;
3724 }
3725
3726 // Xinef: apply DAMAGE_CLASS_MAGIC conditions to damaging DAMAGE_CLASS_NONE spells
3727 for (uint8 i = EFFECT_0; i < MAX_SPELL_EFFECTS; ++i)
3728 {
3729 if (spellInfo->Effects[i].Effect && spellInfo->Effects[i].Effect != SPELL_EFFECT_SCHOOL_DAMAGE)
3730 {
3731 if (spellInfo->Effects[i].ApplyAuraName != SPELL_AURA_PERIODIC_DAMAGE)
3732 {
3733 return SPELL_MISS_NONE;
3734 }
3735 }
3736 }
3737 [[fallthrough]];
3738 }
3740 return MagicSpellHitResult(victim, spellInfo);
3741 }
3742
3743 return SPELL_MISS_NONE;
3744}
@ SPELL_EFFECT_DISPEL
Definition SharedDefines.h:827
@ SPELL_MISS_IMMUNE
Definition SharedDefines.h:1537
@ SPELL_MISS_EVADE
Definition SharedDefines.h:1536
@ SPELL_MISS_REFLECT
Definition SharedDefines.h:1541
@ SPELL_AURA_REFLECT_SPELLS_SCHOOL
Definition SpellAuraDefines.h:137
bool HasEffect(SpellEffects effect) const
Definition SpellInfo.cpp:876
uint32 DmgClass
Definition SpellInfo.h:389
SpellMissInfo MagicSpellHitResult(Unit *victim, SpellInfo const *spell)
Definition Unit.cpp:3457
SpellMissInfo MeleeSpellHitResult(Unit *victim, SpellInfo const *spell)
Definition Unit.cpp:3284

References SpellInfo::DmgClass, EFFECT_0, SpellInfo::Effects, SpellInfo::GetSchoolMask(), Spell::GetSpellInfo(), GetTotalAuraModifier(), GetTotalAuraModifierByMiscMask(), SpellInfo::HasAttribute(), SpellInfo::HasAura(), SpellInfo::HasEffect(), Object::IsCreature(), Creature::IsEvadingAttacks(), IsHostileTo(), IsImmunedToSchool(), IsImmunedToSpell(), SpellInfo::IsPositive(), MagicSpellHitResult(), MAX_SPELL_EFFECTS, MeleeSpellHitResult(), roll_chance_i(), SPELL_ATTR0_CU_IGNORE_EVADE, SPELL_ATTR1_AURA_STAYS_AFTER_COMBAT, SPELL_AURA_CONTROL_VEHICLE, SPELL_AURA_PERIODIC_DAMAGE, SPELL_AURA_REFLECT_SPELLS, SPELL_AURA_REFLECT_SPELLS_SCHOOL, SPELL_DAMAGE_CLASS_MAGIC, SPELL_DAMAGE_CLASS_MELEE, SPELL_DAMAGE_CLASS_NONE, SPELL_DAMAGE_CLASS_RANGED, SPELL_EFFECT_DISPEL, SPELL_EFFECT_SCHOOL_DAMAGE, SPELL_MISS_EVADE, SPELL_MISS_IMMUNE, SPELL_MISS_NONE, SPELL_MISS_REFLECT, SpellInfo::SpellFamilyName, and Object::ToCreature().

◆ SpellHitResult() [2/2]

SpellMissInfo Unit::SpellHitResult ( Unit victim,
SpellInfo const *  spell,
bool  canReflect = false 
)
Todo:
: client not show miss log for this spells - so need find info for this in dbc and use it!
3601{
3602 // Check for immune
3603 if (victim->IsImmunedToSpell(spell))
3604 return SPELL_MISS_IMMUNE;
3605
3606 // All positive spells can`t miss
3608 if ((spell->IsPositive() || spell->HasEffect(SPELL_EFFECT_DISPEL))
3609 && (!IsHostileTo(victim))) // prevent from affecting enemy by "positive" spell
3610 return SPELL_MISS_NONE;
3611
3612 // Check for immune
3613 // xinef: check for school immunity only
3614 if (victim->IsImmunedToSchool(spell))
3615 return SPELL_MISS_IMMUNE;
3616
3617 if (this == victim)
3618 return SPELL_MISS_NONE;
3619
3620 // Return evade for units in evade mode
3621 if (victim->IsCreature() && victim->ToCreature()->IsEvadingAttacks() && !spell->HasAura(SPELL_AURA_CONTROL_VEHICLE)
3622 && !spell->HasAttribute(SPELL_ATTR0_CU_IGNORE_EVADE) && !spell->HasAttribute(SPELL_ATTR1_AURA_STAYS_AFTER_COMBAT))
3623 return SPELL_MISS_EVADE;
3624
3625 // Try victim reflect spell
3626 if (CanReflect)
3627 {
3628 int32 reflectchance = victim->GetTotalAuraModifier(SPELL_AURA_REFLECT_SPELLS);
3629 reflectchance += victim->GetTotalAuraModifierByMiscMask(SPELL_AURA_REFLECT_SPELLS_SCHOOL, spell->GetSchoolMask());
3630
3631 if (reflectchance > 0 && roll_chance_i(reflectchance))
3632 {
3633 // Start triggers for remove charges if need (trigger only for victim, and mark as active spell)
3634 //ProcSkillsAndAuras(victim, PROC_FLAG_NONE, PROC_FLAG_TAKEN_SPELL_MAGIC_DMG_CLASS_NEG, PROC_EX_REFLECT, 1, BASE_ATTACK, spell);
3635 return SPELL_MISS_REFLECT;
3636 }
3637 }
3638
3639 switch (spell->DmgClass)
3640 {
3643 return MeleeSpellHitResult(victim, spell);
3645 {
3646 if (spell->SpellFamilyName)
3647 {
3648 return SPELL_MISS_NONE;
3649 }
3650 // Xinef: apply DAMAGE_CLASS_MAGIC conditions to damaging DAMAGE_CLASS_NONE spells
3651 for (uint8 i = EFFECT_0; i < MAX_SPELL_EFFECTS; ++i)
3652 if (spell->Effects[i].Effect && spell->Effects[i].Effect != SPELL_EFFECT_SCHOOL_DAMAGE)
3653 if (spell->Effects[i].ApplyAuraName != SPELL_AURA_PERIODIC_DAMAGE)
3654 return SPELL_MISS_NONE;
3655 [[fallthrough]];
3656 }
3658 return MagicSpellHitResult(victim, spell);
3659 }
3660 return SPELL_MISS_NONE;
3661}

References SpellInfo::DmgClass, EFFECT_0, SpellInfo::Effects, SpellInfo::GetSchoolMask(), GetTotalAuraModifier(), GetTotalAuraModifierByMiscMask(), SpellInfo::HasAttribute(), SpellInfo::HasAura(), SpellInfo::HasEffect(), Object::IsCreature(), Creature::IsEvadingAttacks(), IsHostileTo(), IsImmunedToSchool(), IsImmunedToSpell(), SpellInfo::IsPositive(), MagicSpellHitResult(), MAX_SPELL_EFFECTS, MeleeSpellHitResult(), roll_chance_i(), SPELL_ATTR0_CU_IGNORE_EVADE, SPELL_ATTR1_AURA_STAYS_AFTER_COMBAT, SPELL_AURA_CONTROL_VEHICLE, SPELL_AURA_PERIODIC_DAMAGE, SPELL_AURA_REFLECT_SPELLS, SPELL_AURA_REFLECT_SPELLS_SCHOOL, SPELL_DAMAGE_CLASS_MAGIC, SPELL_DAMAGE_CLASS_MELEE, SPELL_DAMAGE_CLASS_NONE, SPELL_DAMAGE_CLASS_RANGED, SPELL_EFFECT_DISPEL, SPELL_EFFECT_SCHOOL_DAMAGE, SPELL_MISS_EVADE, SPELL_MISS_IMMUNE, SPELL_MISS_NONE, SPELL_MISS_REFLECT, SpellInfo::SpellFamilyName, and Object::ToCreature().

Referenced by Spell::AddUnitTarget(), DealDamageShieldDamage(), AuraEffect::HandlePeriodicDamageAurasTick(), AuraEffect::HandlePeriodicHealthLeechAuraTick(), and AuraEffect::HandlePeriodicManaLeechAuraTick().

◆ SpellPctDamageModsDone()

float Unit::SpellPctDamageModsDone ( Unit victim,
SpellInfo const *  spellProto,
DamageEffectType  damagetype 
)
8277{
8278 if (!spellProto || !victim || damagetype == DIRECT_DAMAGE)
8279 return 1.0f;
8280
8281 // Some spells don't benefit from done mods
8282 if (spellProto->HasAttribute(SPELL_ATTR3_IGNORE_CASTER_MODIFIERS))
8283 return 1.0f;
8284
8285 // For totems get damage bonus from owner
8286 if (IsCreature())
8287 {
8288 if (IsTotem())
8289 {
8290 if (Unit* owner = GetOwner())
8291 return owner->SpellPctDamageModsDone(victim, spellProto, damagetype);
8292 }
8293 // Dancing Rune Weapon...
8294 else if (GetEntry() == 27893)
8295 {
8296 if (Unit* owner = GetOwner())
8297 return owner->SpellPctDamageModsDone(victim, spellProto, damagetype);
8298 }
8299 }
8300
8301 // Done total percent damage auras
8302 float DoneTotalMod = 1.0f;
8303
8304 DoneTotalMod *= GetTotalAuraMultiplier(SPELL_AURA_MOD_DAMAGE_PERCENT_DONE, [spellProto, this, damagetype](AuraEffect const* aurEff)
8305 {
8306 // prevent apply mods from weapon specific case to non weapon specific spells (Example: thunder clap and two-handed weapon specialization)
8307 if (spellProto->EquippedItemClass == -1 && aurEff->GetSpellInfo()->EquippedItemClass != -1 &&
8309 {
8310 return false;
8311 }
8312
8313 if (!spellProto->ValidateAttribute6SpellDamageMods(this, aurEff, damagetype == DOT))
8314 return false;
8315
8316 if (aurEff->GetMiscValue() & spellProto->GetSchoolMask())
8317 {
8318 if (aurEff->GetSpellInfo()->EquippedItemClass == -1)
8319 return true;
8321 return true;
8322 else if (ToPlayer() && ToPlayer()->HasItemFitToSpellRequirements(aurEff->GetSpellInfo()))
8323 return true;
8324 }
8325 return false;
8326 });
8327
8328 uint32 creatureTypeMask = victim->GetCreatureTypeMask();
8329 DoneTotalMod *= GetTotalAuraMultiplier(SPELL_AURA_MOD_DAMAGE_DONE_VERSUS, [creatureTypeMask, spellProto, damagetype, this](AuraEffect const* aurEff)
8330 {
8331 return creatureTypeMask & aurEff->GetMiscValue() && spellProto->ValidateAttribute6SpellDamageMods(this, aurEff, damagetype == DOT);
8332 });
8333
8334 // bonus against aurastate
8335 DoneTotalMod *= GetTotalAuraMultiplier(SPELL_AURA_MOD_DAMAGE_DONE_VERSUS_AURASTATE, [victim, spellProto, damagetype, this](AuraEffect const* aurEff)
8336 {
8337 return victim->HasAuraState(AuraStateType(aurEff->GetMiscValue())) && spellProto->ValidateAttribute6SpellDamageMods(this, aurEff, damagetype == DOT);
8338 });
8339
8340 // done scripted mod (take it from owner)
8341 Unit* owner = GetOwner() ? GetOwner() : this;
8342 AuraEffectList const& mOverrideClassScript = owner->GetAuraEffectsByType(SPELL_AURA_OVERRIDE_CLASS_SCRIPTS);
8343 for (AuraEffectList::const_iterator i = mOverrideClassScript.begin(); i != mOverrideClassScript.end(); ++i)
8344 {
8345 // Xinef: self cast is ommited (because of Rage of Rivendare)
8346 if (!spellProto->ValidateAttribute6SpellDamageMods(this, *i, damagetype == DOT))
8347 continue;
8348
8349 // xinef: Molten Fury should work on all spells
8350 switch ((*i)->GetMiscValue())
8351 {
8352 case 4920: // Molten Fury
8353 case 4919:
8354 if (victim->HasAuraState(AURA_STATE_HEALTHLESS_35_PERCENT, spellProto, this))
8355 AddPct(DoneTotalMod, (*i)->GetAmount());
8356 break;
8357 }
8358
8359 if (!(*i)->IsAffectedOnSpell(spellProto))
8360 continue;
8361
8362 switch ((*i)->GetMiscValue())
8363 {
8364 case 6917: // Death's Embrace
8365 case 6926:
8366 case 6928:
8367 {
8368 if (victim->HasAuraState(AURA_STATE_HEALTHLESS_35_PERCENT, spellProto, this))
8369 AddPct(DoneTotalMod, (*i)->GetAmount());
8370 break;
8371 }
8372 // Soul Siphon
8373 case 4992:
8374 case 4993:
8375 {
8376 // effect 1 m_amount
8377 int32 maxPercent = (*i)->GetAmount();
8378 // effect 0 m_amount
8379 int32 stepPercent = CalculateSpellDamage(this, (*i)->GetSpellInfo(), 0);
8380 // count affliction effects and calc additional damage in percentage
8381 int32 modPercent = 0;
8382 AuraApplicationMap const& victimAuras = victim->GetAppliedAuras();
8383 for (AuraApplicationMap::const_iterator itr = victimAuras.begin(); itr != victimAuras.end(); ++itr)
8384 {
8385 Aura const* aura = itr->second->GetBase();
8386 SpellInfo const* m_spell = aura->GetSpellInfo();
8387 if (m_spell->SpellFamilyName != SPELLFAMILY_WARLOCK || !(m_spell->SpellFamilyFlags[1] & 0x0004071B || m_spell->SpellFamilyFlags[0] & 0x8044C402))
8388 continue;
8389 modPercent += stepPercent * aura->GetStackAmount();
8390 if (modPercent >= maxPercent)
8391 {
8392 modPercent = maxPercent;
8393 break;
8394 }
8395 }
8396 AddPct(DoneTotalMod, modPercent);
8397 break;
8398 }
8399 case 6916: // Death's Embrace
8400 case 6925:
8401 case 6927:
8402 if (HasAuraState(AURA_STATE_HEALTHLESS_20_PERCENT, spellProto, this))
8403 AddPct(DoneTotalMod, (*i)->GetAmount());
8404 break;
8405 case 5481: // Starfire Bonus
8406 {
8407 if (victim->GetAuraEffect(SPELL_AURA_PERIODIC_DAMAGE, SPELLFAMILY_DRUID, 0x200002, 0, 0))
8408 AddPct(DoneTotalMod, (*i)->GetAmount());
8409 break;
8410 }
8411 // Tundra Stalker
8412 // Merciless Combat
8413 case 7277:
8414 {
8415 // Merciless Combat
8416 if ((*i)->GetSpellInfo()->SpellIconID == 2656)
8417 {
8418 if ((spellProto && spellProto->SpellFamilyFlags[0] & 0x2) || spellProto->SpellFamilyFlags[1] & 0x2 )
8419 if (!victim->HealthAbovePct(35))
8420 AddPct(DoneTotalMod, (*i)->GetAmount());
8421 }
8422 // Tundra Stalker
8423 else
8424 {
8425 // Frost Fever (target debuff)
8426 if (victim->HasAura(55095))
8427 AddPct(DoneTotalMod, (*i)->GetAmount());
8428 break;
8429 }
8430 break;
8431 }
8432 // Rage of Rivendare
8433 case 7293:
8434 {
8436 AddPct(DoneTotalMod, (*i)->GetSpellInfo()->GetRank() * 2.0f);
8437 break;
8438 }
8439 // Twisted Faith
8440 case 7377:
8441 {
8443 AddPct(DoneTotalMod, (*i)->GetAmount());
8444 break;
8445 }
8446 // Marked for Death
8447 case 7598:
8448 case 7599:
8449 case 7600:
8450 case 7601:
8451 case 7602:
8452 {
8453 if (victim->GetAuraEffect(SPELL_AURA_MOD_STALKED, SPELLFAMILY_HUNTER, 0x400, 0, 0))
8454 AddPct(DoneTotalMod, (*i)->GetAmount());
8455 break;
8456 }
8457 // Dirty Deeds
8458 case 6427:
8459 case 6428:
8460 case 6579:
8461 case 6580:
8462 {
8463 if (victim->HasAuraState(AURA_STATE_HEALTHLESS_35_PERCENT, spellProto, this))
8464 {
8465 // effect 0 has expected value but in negative state
8466 int32 bonus = -(*i)->GetBase()->GetEffect(0)->GetAmount();
8467 AddPct(DoneTotalMod, bonus);
8468 }
8469 break;
8470 }
8471 }
8472 }
8473
8474 // Custom scripted damage
8475 switch (spellProto->SpellFamilyName)
8476 {
8477 case SPELLFAMILY_MAGE:
8478 // Ice Lance
8479 if (spellProto->SpellIconID == 186)
8480 {
8481 if (victim->HasAuraState(AURA_STATE_FROZEN, spellProto, this))
8482 {
8483 // Glyph of Ice Lance
8484 if (owner->HasAura(56377) && victim->GetLevel() > owner->GetLevel())
8485 DoneTotalMod *= 4.0f;
8486 else
8487 DoneTotalMod *= 3.0f;
8488 }
8489 }
8490
8491 // Torment the weak
8492 if (spellProto->SpellFamilyFlags[0] & 0x20600021 || spellProto->SpellFamilyFlags[1] & 0x9000)
8493 if (victim->HasAuraWithMechanic((1 << MECHANIC_SNARE) | (1 << MECHANIC_SLOW_ATTACK)))
8495 AddPct(DoneTotalMod, aurEff->GetAmount());
8496 break;
8497 case SPELLFAMILY_PRIEST:
8498 // Mind Flay
8499 if (spellProto->SpellFamilyFlags[0] & 0x800000)
8500 {
8501 // Glyph of Shadow Word: Pain
8502 if (AuraEffect* aurEff = GetAuraEffect(55687, 0))
8503 // Increase Mind Flay damage if Shadow Word: Pain present on target
8505 AddPct(DoneTotalMod, aurEff->GetAmount());
8506
8507 // Twisted Faith - Mind Flay part
8509 // Increase Mind Flay damage if Shadow Word: Pain present on target
8511 AddPct(DoneTotalMod, aurEff->GetAmount());
8512 }
8513 // Smite
8514 else if (spellProto->SpellFamilyFlags[0] & 0x80)
8515 {
8516 // Glyph of Smite
8517 if (AuraEffect* aurEff = GetAuraEffect(55692, 0))
8518 if (victim->GetAuraEffect(SPELL_AURA_PERIODIC_DAMAGE, SPELLFAMILY_PRIEST, 0x100000, 0, 0, GetGUID()))
8519 AddPct(DoneTotalMod, aurEff->GetAmount());
8520 }
8521 // Shadow Word: Death
8522 else if (spellProto->SpellFamilyFlags[1] & 0x2)
8523 {
8524 // Glyph of Shadow Word: Death
8525 if (AuraEffect* aurEff = GetAuraEffect(55682, 1))
8527 AddPct(DoneTotalMod, aurEff->GetAmount());
8528 }
8529
8530 break;
8532 // Judgement of Vengeance/Judgement of Corruption
8533 if ((spellProto->SpellFamilyFlags[1] & 0x400000) && spellProto->SpellIconID == 2292)
8534 {
8535 // Get stack of Holy Vengeance/Blood Corruption on the target added by caster
8536 uint32 stacks = 0;
8538 for (Unit::AuraEffectList::const_iterator itr = auras.begin(); itr != auras.end(); ++itr)
8539 if (((*itr)->GetId() == 31803 || (*itr)->GetId() == 53742) && (*itr)->GetCasterGUID() == GetGUID())
8540 {
8541 stacks = (*itr)->GetBase()->GetStackAmount();
8542 break;
8543 }
8544 // + 10% for each application of Holy Vengeance/Blood Corruption on the target
8545 if (stacks)
8546 AddPct(DoneTotalMod, 10 * stacks);
8547 }
8548 break;
8549 case SPELLFAMILY_DRUID:
8550 // Thorns
8551 if (spellProto->SpellFamilyFlags[0] & 0x100)
8552 {
8553 // Brambles
8554 if (AuraEffect* aurEff = GetAuraEffectOfRankedSpell(16836, 0))
8555 AddPct(DoneTotalMod, aurEff->GetAmount());
8556 }
8557 break;
8559 // Fire and Brimstone
8560 if (spellProto->SpellFamilyFlags[1] & 0x00020040)
8562 {
8564 for (AuraEffectList::const_iterator i = mDumyAuras.begin(); i != mDumyAuras.end(); ++i)
8565 if ((*i)->GetSpellInfo()->SpellIconID == 3173)
8566 {
8567 AddPct(DoneTotalMod, (*i)->GetAmount());
8568 break;
8569 }
8570 }
8571 // Drain Soul - increased damage for targets under 25 % HP
8572 if (spellProto->SpellFamilyFlags[0] & 0x00004000)
8573 if (!victim->HealthAbovePct(25))
8574 DoneTotalMod *= 4;
8575 // Shadow Bite (15% increase from each dot)
8576 if (spellProto->SpellFamilyFlags[1] & 0x00400000 && IsPet())
8577 if (uint8 count = victim->GetDoTsByCaster(GetOwnerGUID()))
8578 AddPct(DoneTotalMod, 15 * count);
8579 break;
8580 case SPELLFAMILY_HUNTER:
8581 // Steady Shot
8582 if (spellProto->SpellFamilyFlags[1] & 0x1)
8583 if (AuraEffect* aurEff = GetAuraEffect(56826, 0)) // Glyph of Steady Shot
8584 if (victim->GetAuraEffect(SPELL_AURA_PERIODIC_DAMAGE, SPELLFAMILY_HUNTER, 0x00004000, 0, 0, GetGUID()))
8585 AddPct(DoneTotalMod, aurEff->GetAmount());
8586 break;
8588 // Improved Icy Touch
8589 if (spellProto->SpellFamilyFlags[0] & 0x2)
8591 AddPct(DoneTotalMod, aurEff->GetAmount());
8592
8593 // Glacier Rot
8594 if (spellProto->SpellFamilyFlags[0] & 0x2 || spellProto->SpellFamilyFlags[1] & 0x6)
8596 if (victim->GetDiseasesByCaster(owner->GetGUID()) > 0)
8597 AddPct(DoneTotalMod, aurEff->GetAmount());
8598 break;
8599 }
8600
8601 return DoneTotalMod;
8602}
@ SPELL_ATTR5_AURA_AFFECTS_NOT_JUST_REQ_EQUIPPED_ITEM
Definition SharedDefines.h:594
@ MECHANIC_SLOW_ATTACK
Definition SharedDefines.h:1344
@ SPELLFAMILY_WARLOCK
Definition SharedDefines.h:3789
@ SPELLFAMILY_MAGE
Definition SharedDefines.h:3787
@ SPELLFAMILY_GENERIC
Definition SharedDefines.h:3784
@ AURA_STATE_HEALTHLESS_20_PERCENT
Definition SharedDefines.h:1304
@ AURA_STATE_CONFLAGRATE
Definition SharedDefines.h:1317
int32 EquippedItemSubClassMask
Definition SpellInfo.h:376
bool HealthAbovePct(int32 pct) const
Definition Unit.h:1107
int32 CalculateSpellDamage(Unit const *target, SpellInfo const *spellProto, uint8 effect_index, int32 const *basePoints=nullptr) const
Definition Unit.cpp:11731
uint32 GetDiseasesByCaster(ObjectGuid casterGUID, uint8 mode=0)
Definition Unit.cpp:6069
bool HasAuraWithMechanic(uint32 mechanicMask) const
Definition Unit.cpp:6040
uint32 GetDoTsByCaster(ObjectGuid casterGUID) const
Definition Unit.cpp:6123

References AddPct(), AURA_STATE_CONFLAGRATE, AURA_STATE_FROZEN, AURA_STATE_HEALTHLESS_20_PERCENT, AURA_STATE_HEALTHLESS_35_PERCENT, CalculateSpellDamage(), DIRECT_DAMAGE, DOT, EFFECT_0, SpellInfo::EquippedItemClass, SpellInfo::EquippedItemSubClassMask, AuraEffect::GetAmount(), GetAppliedAuras(), GetAuraEffect(), GetAuraEffectOfRankedSpell(), GetAuraEffectsByType(), GetCreatureTypeMask(), GetDiseasesByCaster(), GetDoTsByCaster(), GetDummyAuraEffect(), Object::GetEntry(), Object::GetGUID(), GetLevel(), AuraEffect::GetMiscValue(), GetOwner(), GetOwnerGUID(), SpellInfo::GetSchoolMask(), AuraEffect::GetSpellInfo(), Aura::GetSpellInfo(), Aura::GetStackAmount(), GetTotalAuraMultiplier(), SpellInfo::HasAttribute(), HasAura(), HasAuraState(), HasAuraWithMechanic(), HealthAbovePct(), Object::IsCreature(), IsPet(), IsTotem(), MECHANIC_SLOW_ATTACK, MECHANIC_SNARE, SPELL_ATTR3_IGNORE_CASTER_MODIFIERS, SPELL_ATTR5_AURA_AFFECTS_NOT_JUST_REQ_EQUIPPED_ITEM, SPELL_AURA_DUMMY, SPELL_AURA_MOD_DAMAGE_DONE_VERSUS, SPELL_AURA_MOD_DAMAGE_DONE_VERSUS_AURASTATE, SPELL_AURA_MOD_DAMAGE_PERCENT_DONE, SPELL_AURA_MOD_STALKED, SPELL_AURA_OVERRIDE_CLASS_SCRIPTS, SPELL_AURA_PERIODIC_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, SPELLFAMILY_DEATHKNIGHT, SPELLFAMILY_DRUID, SPELLFAMILY_GENERIC, SPELLFAMILY_HUNTER, SPELLFAMILY_MAGE, SPELLFAMILY_PALADIN, SPELLFAMILY_PRIEST, SPELLFAMILY_WARLOCK, SpellInfo::SpellFamilyFlags, SpellInfo::SpellFamilyName, SpellInfo::SpellIconID, Object::ToPlayer(), and SpellInfo::ValidateAttribute6SpellDamageMods().

Referenced by AuraEffect::CalculatePeriodicData(), and SpellDamageBonusDone().

◆ SpellPctHealingModsDone()

float Unit::SpellPctHealingModsDone ( Unit victim,
SpellInfo const *  spellProto,
DamageEffectType  damagetype 
)
9323{
9324 // For totems get healing bonus from owner (statue isn't totem in fact)
9325 if (IsCreature() && IsTotem())
9326 if (Unit* owner = GetOwner())
9327 return owner->SpellPctHealingModsDone(victim, spellProto, damagetype);
9328
9329 // Some spells don't benefit from done mods
9330 if (spellProto->HasAttribute(SPELL_ATTR3_IGNORE_CASTER_MODIFIERS))
9331 return 1.0f;
9332
9333 // xinef: Some spells don't benefit from done mods
9334 if (spellProto->HasAttribute(SPELL_ATTR6_IGNORE_HEALTH_MODIFIERS))
9335 return 1.0f;
9336
9337 // No bonus healing for potion spells
9338 if (spellProto->SpellFamilyName == SPELLFAMILY_POTION)
9339 return 1.0f;
9340
9341 float DoneTotalMod = 1.0f;
9342
9343 // Healing done percent
9345
9346 // done scripted mod (take it from owner)
9347 Unit* owner = GetOwner() ? GetOwner() : this;
9348 AuraEffectList const& mOverrideClassScript = owner->GetAuraEffectsByType(SPELL_AURA_OVERRIDE_CLASS_SCRIPTS);
9349 for (AuraEffectList::const_iterator i = mOverrideClassScript.begin(); i != mOverrideClassScript.end(); ++i)
9350 {
9351 if (!(*i)->IsAffectedOnSpell(spellProto))
9352 continue;
9353
9354 switch ((*i)->GetMiscValue())
9355 {
9356 case 21: // Test of Faith
9357 case 6935:
9358 case 6918:
9359 if (victim->HealthBelowPct(50))
9360 AddPct(DoneTotalMod, (*i)->GetAmount());
9361 break;
9362 case 7798: // Glyph of Regrowth
9363 {
9365 AddPct(DoneTotalMod, (*i)->GetAmount());
9366 break;
9367 }
9368
9369 case 7871: // Glyph of Lesser Healing Wave
9370 {
9371 // xinef: affected by any earth shield
9372 if (victim->GetAuraEffect(SPELL_AURA_DUMMY, SPELLFAMILY_SHAMAN, 0, 0x00000400, 0))
9373 AddPct(DoneTotalMod, (*i)->GetAmount());
9374 break;
9375 }
9376 default:
9377 break;
9378 }
9379 }
9380
9381 switch (spellProto->SpellFamilyName)
9382 {
9384 // Talents and glyphs for healing stream totem
9385 if (spellProto->Id == 52042)
9386 {
9387 // Glyph of Healing Stream Totem
9388 if (AuraEffect* dummy = owner->GetAuraEffect(55456, EFFECT_0))
9389 AddPct(DoneTotalMod, dummy->GetAmount());
9390
9391 // Healing Stream totem - Restorative Totems
9392 if (AuraEffect* aurEff = GetDummyAuraEffect(SPELLFAMILY_SHAMAN, 338, 1))
9393 AddPct(DoneTotalMod, aurEff->GetAmount());
9394 }
9395 break;
9396 case SPELLFAMILY_PRIEST:
9397 // T9 HEALING 4P, empowered renew instant heal
9398 if (spellProto->Id == 63544)
9399 if (AuraEffect* aurEff = GetAuraEffect(67202, EFFECT_0))
9400 AddPct(DoneTotalMod, aurEff->GetAmount());
9401 break;
9402 }
9403
9404 return DoneTotalMod;
9405}
@ SPELLFAMILY_SHAMAN
Definition SharedDefines.h:3795
@ SPELL_AURA_MOD_HEALING_DONE_PERCENT
Definition SpellAuraDefines.h:199

References AddPct(), EFFECT_0, GetAuraEffect(), GetAuraEffectsByType(), GetDummyAuraEffect(), GetOwner(), GetTotalAuraMultiplier(), SpellInfo::HasAttribute(), HealthBelowPct(), SpellInfo::Id, Object::IsCreature(), IsTotem(), SPELL_ATTR3_IGNORE_CASTER_MODIFIERS, SPELL_ATTR6_IGNORE_HEALTH_MODIFIERS, SPELL_AURA_DUMMY, SPELL_AURA_MOD_HEALING_DONE_PERCENT, SPELL_AURA_OVERRIDE_CLASS_SCRIPTS, SPELL_AURA_PERIODIC_HEAL, SPELLFAMILY_DRUID, SPELLFAMILY_GENERIC, SPELLFAMILY_POTION, SPELLFAMILY_PRIEST, SPELLFAMILY_SHAMAN, and SpellInfo::SpellFamilyName.

Referenced by AuraEffect::CalculatePeriodicData(), and SpellHealingBonusDone().

◆ SpellTakenCritChance()

float Unit::SpellTakenCritChance ( Unit const *  caster,
SpellInfo const *  spellProto,
SpellSchoolMask  schoolMask,
float  doneChance,
WeaponAttackType  attackType,
bool  skipEffectCheck 
) const
Todo:
: Not sure whether the fallthrough was a mistake (forgetting a break) or intended. This should be double-checked.
9036{
9037 // not critting spell
9038 if (spellProto->HasAttribute(SPELL_ATTR2_CANT_CRIT))
9039 return 0.0f;
9040
9041 // Xinef: check if spell is capable of critting, auras requires special aura to crit so they can be skipped
9042 if (!skipEffectCheck && !spellProto->IsCritCapable())
9043 return 0.0f;
9044
9045 float crit_chance = doneChance;
9046 switch (spellProto->DmgClass)
9047 {
9049 {
9050 if (!spellProto->IsPositive())
9051 {
9052 // Modify critical chance by victim SPELL_AURA_MOD_ATTACKER_SPELL_CRIT_CHANCE
9053 // xinef: apply max and min only
9055 {
9058 }
9059
9060 Unit::ApplyResilience(this, &crit_chance, nullptr, false, CR_CRIT_TAKEN_SPELL);
9061 }
9062 // scripted (increase crit chance ... against ... target by x%
9063 if (caster)
9064 {
9065 AuraEffectList const& mOverrideClassScript = caster->GetAuraEffectsByType(SPELL_AURA_OVERRIDE_CLASS_SCRIPTS);
9066 for (AuraEffectList::const_iterator i = mOverrideClassScript.begin(); i != mOverrideClassScript.end(); ++i)
9067 {
9068 if (!((*i)->IsAffectedOnSpell(spellProto)))
9069 continue;
9070 int32 modChance = 0;
9071 switch ((*i)->GetMiscValue())
9072 {
9073 // Shatter
9074 case 911:
9075 modChance += 16;
9076 [[fallthrough]];
9077 case 910:
9078 modChance += 17;
9079 [[fallthrough]];
9080 case 849:
9081 modChance += 17;
9082 if (!HasAuraState(AURA_STATE_FROZEN, spellProto, caster))
9083 break;
9084 crit_chance += modChance;
9085 break;
9086 case 7917: // Glyph of Shadowburn
9087 if (HasAuraState(AURA_STATE_HEALTHLESS_35_PERCENT, spellProto, caster))
9088 crit_chance += (*i)->GetAmount();
9089 break;
9090 case 7997: // Renewed Hope
9091 case 7998:
9092 if (HasAura(6788))
9093 crit_chance += (*i)->GetAmount();
9094 break;
9095 default:
9096 break;
9097 }
9098 }
9099 // Custom crit by class
9100 switch (spellProto->SpellFamilyName)
9101 {
9102 case SPELLFAMILY_MAGE:
9103 // Glyph of Fire Blast
9104 if (spellProto->SpellFamilyFlags[0] == 0x2 && spellProto->SpellIconID == 12)
9106 if (AuraEffect const* aurEff = caster->GetAuraEffect(56369, EFFECT_0))
9107 crit_chance += aurEff->GetAmount();
9108 break;
9109 case SPELLFAMILY_DRUID:
9110 // Improved Faerie Fire
9112 if (AuraEffect const* aurEff = caster->GetDummyAuraEffect(SPELLFAMILY_DRUID, 109, 0))
9113 crit_chance += aurEff->GetAmount();
9114
9115 // cumulative effect - don't break
9116
9117 // Starfire
9118 if (spellProto->SpellFamilyFlags[0] & 0x4 && spellProto->SpellIconID == 1485)
9119 {
9120 // Improved Insect Swarm
9121 if (AuraEffect const* aurEff = caster->GetDummyAuraEffect(SPELLFAMILY_DRUID, 1771, 0))
9123 crit_chance += aurEff->GetAmount();
9124 break;
9125 }
9126 break;
9127 case SPELLFAMILY_ROGUE:
9128 // Shiv-applied poisons can't crit
9129 if (caster->FindCurrentSpellBySpellId(5938))
9130 crit_chance = 0.0f;
9131 break;
9133 // Flash of light
9134 if (spellProto->SpellFamilyFlags[0] & 0x40000000)
9135 {
9136 // Sacred Shield
9137 if (AuraEffect const* aura = GetAuraEffect(58597, 1, GetGUID()))
9138 crit_chance += aura->GetAmount();
9139 break;
9140 }
9141 // Exorcism
9142 else if (spellProto->GetCategory() == 19)
9143 {
9145 return 100.0f;
9146 break;
9147 }
9148 break;
9149 case SPELLFAMILY_SHAMAN:
9150 // Lava Burst
9151 if (spellProto->SpellFamilyFlags[1] & 0x00001000)
9152 {
9153 if (GetAuraEffect(SPELL_AURA_PERIODIC_DAMAGE, SPELLFAMILY_SHAMAN, 0x10000000, 0, 0, caster->GetGUID()))
9155 return 100.0f;
9156 break;
9157 }
9158 break;
9159 }
9160 }
9161 break;
9162 }
9164 // Custom crit by class
9165 if (caster)
9166 {
9167 switch (spellProto->SpellFamilyName)
9168 {
9169 case SPELLFAMILY_DRUID:
9170 // Rend and Tear - bonus crit chance for Ferocious Bite on bleeding targets
9171 if (spellProto->SpellFamilyFlags[0] & 0x00800000 && spellProto->SpellIconID == 1680 && HasAuraState(AURA_STATE_BLEEDING))
9172 {
9173 if (AuraEffect const* rendAndTear = caster->GetDummyAuraEffect(SPELLFAMILY_DRUID, 2859, 1))
9174 crit_chance += rendAndTear->GetAmount();
9175 break;
9176 }
9177 break;
9179 // Victory Rush
9180 if (spellProto->SpellFamilyFlags[1] & 0x100)
9181 {
9182 // Glyph of Victory Rush
9183 if (AuraEffect const* aurEff = caster->GetAuraEffect(58382, 0))
9184 crit_chance += aurEff->GetAmount();
9185 break;
9186 }
9187 break;
9188 }
9189 }
9190
9191 // 100% critical chance against sitting target
9193 {
9194 return 100.0f;
9195 }
9196 [[fallthrough]];
9198 {
9199 // flat aura mods
9200 if (attackType == RANGED_ATTACK)
9202 else
9204
9205 // reduce crit chance from Rating for players
9206 if (attackType != RANGED_ATTACK)
9207 {
9208 // xinef: little hack, crit chance dont require caster to calculate, pass victim
9209 Unit::ApplyResilience(this, &crit_chance, nullptr, false, CR_CRIT_TAKEN_MELEE);
9210 }
9211 else
9212 Unit::ApplyResilience(this, &crit_chance, nullptr, false, CR_CRIT_TAKEN_RANGED);
9213
9214 // Apply crit chance from defence skill
9215 if (caster)
9216 crit_chance += (int32(caster->GetMaxSkillValueForLevel(this)) - int32(GetDefenseSkillValue(caster))) * 0.04f;
9217
9218 break;
9219 }
9220 // values overridden in spellmgr for lifebloom and earth shield
9222 default:
9223 return 0.0f;
9224 }
9225
9226 if (caster)
9227 {
9228 crit_chance += GetTotalAuraModifier(SPELL_AURA_MOD_CRIT_CHANCE_FOR_CASTER, [caster](AuraEffect const* aurEff)
9229 {
9230 return caster->GetGUID() == aurEff->GetCasterGUID();
9231 });
9232 }
9233
9234 // Modify critical chance by victim SPELL_AURA_MOD_ATTACKER_SPELL_AND_WEAPON_CRIT_CHANCE
9235 // xinef: should be calculated at the end
9236 if (!spellProto->IsPositive())
9238
9239 // xinef: can be negative!
9240 return crit_chance;
9241}
uint32 const CREATURE_TYPEMASK_DEMON_OR_UNDEAD
Definition SharedDefines.h:2644
@ MECHANIC_KNOCKOUT
Definition SharedDefines.h:1350
@ MECHANIC_STUN
Definition SharedDefines.h:1348
@ SPELLFAMILY_ROGUE
Definition SharedDefines.h:3792
@ AURA_STATE_BLEEDING
Definition SharedDefines.h:1321
@ AURA_STATE_FAERIE_FIRE
Definition SharedDefines.h:1315
bool HasAttackerSpellCritChanceAura() const
Definition Unit.h:1816
int32 GetMaxNegativeAuraModifierByMiscMask(AuraType auratype, uint32 misc_mask) const
Definition Unit.cpp:6282

References ApplyResilience(), AURA_STATE_BLEEDING, AURA_STATE_FAERIE_FIRE, AURA_STATE_FROZEN, AURA_STATE_HEALTHLESS_35_PERCENT, CR_CRIT_TAKEN_MELEE, CR_CRIT_TAKEN_RANGED, CR_CRIT_TAKEN_SPELL, CREATURE_TYPEMASK_DEMON_OR_UNDEAD, SpellInfo::DmgClass, EFFECT_0, FindCurrentSpellBySpellId(), GetAuraEffect(), GetAuraEffectsByType(), AuraEffect::GetCasterGUID(), SpellInfo::GetCategory(), GetCreatureTypeMask(), GetDefenseSkillValue(), GetDummyAuraEffect(), Object::GetGUID(), Object::GetGUID(), GetMaxNegativeAuraModifierByMiscMask(), GetMaxPositiveAuraModifierByMiscMask(), GetMaxSkillValueForLevel(), getStandState(), GetTotalAuraModifier(), HasAttackerSpellCritChanceAura(), SpellInfo::HasAttribute(), HasAura(), HasAuraState(), HasAuraWithMechanic(), SpellInfo::IsCritCapable(), Object::IsPlayer(), SpellInfo::IsPositive(), IsSitState(), MECHANIC_KNOCKOUT, MECHANIC_STUN, RANGED_ATTACK, SPELL_ATTR2_CANT_CRIT, SPELL_AURA_MOD_ATTACKER_MELEE_CRIT_CHANCE, SPELL_AURA_MOD_ATTACKER_RANGED_CRIT_CHANCE, SPELL_AURA_MOD_ATTACKER_SPELL_AND_WEAPON_CRIT_CHANCE, SPELL_AURA_MOD_ATTACKER_SPELL_CRIT_CHANCE, SPELL_AURA_MOD_CRIT_CHANCE_FOR_CASTER, SPELL_AURA_OVERRIDE_CLASS_SCRIPTS, SPELL_AURA_PERIODIC_DAMAGE, SPELL_DAMAGE_CLASS_MAGIC, SPELL_DAMAGE_CLASS_MELEE, SPELL_DAMAGE_CLASS_NONE, SPELL_DAMAGE_CLASS_RANGED, SPELLFAMILY_DRUID, SPELLFAMILY_MAGE, SPELLFAMILY_PALADIN, SPELLFAMILY_ROGUE, SPELLFAMILY_SHAMAN, SPELLFAMILY_WARRIOR, SpellInfo::SpellFamilyFlags, SpellInfo::SpellFamilyName, SpellInfo::SpellIconID, and UNIT_STAND_STATE_SLEEP.

Referenced by AuraEffect::CalcPeriodicCritChance(), and Spell::DoAllEffectOnLaunchTarget().

◆ StartReactiveTimer()

void Unit::StartReactiveTimer ( ReactiveType  reactive)
inline
#define REACTIVE_TIMER_START
Definition Unit.h:609

References m_reactiveTimer, and REACTIVE_TIMER_START.

Referenced by ProcSkillsAndReactives().

◆ StopAttackFaction()

void Unit::StopAttackFaction ( uint32  faction_id)
16264{
16265 if (Unit* victim = GetVictim())
16266 {
16267 if (victim->GetFactionTemplateEntry()->faction == faction_id)
16268 {
16269 AttackStop();
16270 if (IsNonMeleeSpellCast(false))
16272
16273 // melee and ranged forced attack cancel
16274 if (IsPlayer())
16276 }
16277 }
16278
16279 AttackerSet const& attackers = getAttackers();
16280 for (AttackerSet::const_iterator itr = attackers.begin(); itr != attackers.end();)
16281 {
16282 if ((*itr)->GetFactionTemplateEntry()->faction == faction_id)
16283 {
16284 (*itr)->AttackStop();
16285 itr = attackers.begin();
16286 }
16287 else
16288 ++itr;
16289 }
16290
16292
16293 for (ControlSet::const_iterator itr = m_Controlled.begin(); itr != m_Controlled.end(); ++itr)
16294 (*itr)->StopAttackFaction(faction_id);
16295}
void deleteReferencesForFaction(uint32 faction)
Definition HostileRefMgr.cpp:162

References AttackStop(), HostileRefMgr::deleteReferencesForFaction(), getAttackers(), getHostileRefMgr(), GetVictim(), InterruptNonMeleeSpells(), IsNonMeleeSpellCast(), Object::IsPlayer(), m_Controlled, Player::SendAttackSwingCancelAttack(), and Object::ToPlayer().

Referenced by AuraEffect::HandleForceReaction().

◆ StopAttackingInvalidTarget()

void Unit::StopAttackingInvalidTarget ( )
16298{
16299 AttackerSet const& attackers = getAttackers();
16300 for (AttackerSet::const_iterator itr = attackers.begin(); itr != attackers.end();)
16301 {
16302 Unit* attacker = (*itr);
16303 if (!attacker->IsValidAttackTarget(this))
16304 {
16305 attacker->AttackStop();
16306 if (attacker->IsPlayer())
16307 {
16309 }
16310
16311 for (Unit* controlled : attacker->m_Controlled)
16312 {
16313 if (controlled->GetVictim() == this && !controlled->IsValidAttackTarget(this))
16314 {
16315 controlled->AttackStop();
16316 }
16317 }
16318
16319 itr = attackers.begin();
16320 }
16321 else
16322 {
16323 ++itr;
16324 }
16325 }
16326}

References AttackStop(), getAttackers(), Object::IsPlayer(), IsValidAttackTarget(), m_Controlled, Player::SendAttackSwingCancelAttack(), and Object::ToPlayer().

Referenced by RemoveCharmedBy(), and SetCharmedBy().

◆ StopMoving()

void Unit::StopMoving ( )
13137{
13139
13140 // not need send any packets if not in world or not moving
13141 if (!IsInWorld())
13142 return;
13143
13144 if (movespline->Finalized())
13145 return;
13146
13147 // Update position now since Stop does not start a new movement that can be updated later
13148 if (movespline->HasStarted())
13150
13151 Movement::MoveSplineInit init(this);
13152 init.Stop();
13153}
bool HasStarted() const
Definition MoveSpline.h:129
void UpdateSplinePosition()
Definition Unit.cpp:716

References ClearUnitState(), Movement::MoveSpline::Finalized(), Movement::MoveSpline::HasStarted(), Object::IsInWorld(), movespline, Movement::MoveSplineInit::Stop(), UNIT_STATE_MOVING, and UpdateSplinePosition().

Referenced by npc_escortAI::AttackStart(), SmartAI::AttackStart(), boss_alar::ConstructWaypointsAndMove(), boss_baron_geddon::boss_baron_geddonAI::DamageTaken(), boss_grand_champion::boss_grand_championAI::DamageTaken(), npc_ulduar_aerial_command_unit::DamageTaken(), boss_ingvar_the_plunderer::DamageTaken(), npc_vrykul_skeleton::DamageTaken(), npc_blistering_zombie::npc_blistering_zombieAI::DamageTaken(), npc_icc_ice_sphere::npc_icc_ice_sphereAI::DoAction(), npc_kinetic_bomb::npc_kinetic_bombAI::DoAction(), npc_spinestalker::npc_spinestalkerAI::DoAction(), npc_rimefang::npc_rimefangAI::DoAction(), ScriptedAI::DoCastSpell(), FlightPathMovementGenerator::DoFinalize(), FleeingMovementGenerator< T >::DoFinalize(), ConfusedMovementGenerator< T >::DoFinalize(), npc_taskmaster_fizzule::npc_taskmaster_fizzuleAI::DoFriend(), ChaseMovementGenerator< T >::DoInitialize(), WaypointMovementGenerator< Creature >::DoUpdate(), RandomMovementGenerator< T >::DoUpdate(), ChaseMovementGenerator< T >::DoUpdate(), FollowMovementGenerator< T >::DoUpdate(), boss_blood_queen_lana_thel::boss_blood_queen_lana_thelAI::GoToMinchar(), debug_commandscript::HandleDebugMoveflagsCommand(), WorldSession::HandlePetActionHelper(), RotateMovementGenerator::Initialize(), npc_strangulate_vehicle::npc_strangulate_vehicleAI::IsSummonedBy(), boss_kologarn::JustDied(), boss_swamplord_muselek::JustEngagedWith(), boss_janalai::JustEngagedWith(), Player::LeaveBattleground(), boss_headless_horseman::MovementInform(), boss_kaelthas::MovementInform(), boss_jedoga_shadowseeker::MovementInform(), boss_ghazan::MovementInform(), npc_ball_of_flame::npc_ball_of_flameAI::MovementInform(), npc_toc5_player_vehicle::npc_toc5_player_vehicleAI::OnCharmed(), PauseMovement(), SmartAI::PausePath(), npc_hidden_cultist::npc_hidden_cultistAI::PreScript(), RemoveCharmedBy(), Creature::RemoveCorpse(), boss_felblood_kaelthas::Reset(), npc_xt002_scrapbot::Reset(), npc_xt002_boombot::Reset(), boss_leotheras_the_blind::Reset(), IdleMovementGenerator::Reset(), npc_putricide_oozeAI::SelectNewTarget(), npc_icc_ice_sphere::npc_icc_ice_sphereAI::SelectNewTarget(), SendMoveRoot(), SetCharmedBy(), SmartAI::SetCombatMovement(), SetConfused(), boss_victor_nefarius::boss_victor_nefariusAI::SetData(), setDeathState(), SetFeared(), FollowerAI::SetFollowComplete(), FollowerAI::SetFollowPaused(), npc_magister_aledis::sGossipSelect(), npc_harrison_jones::SpellHit(), npc_cult_fanatic::npc_cult_fanaticAI::SpellHit(), npc_cult_adherent::npc_cult_adherentAI::SpellHit(), npc_tirion_fordring_tft::npc_tirion_fordringAI::SpellHit(), boss_urom::boss_uromAI::SpellHit(), npc_vengeful_shade::npc_vengeful_shadeAI::SpellHitTarget(), boss_heigan::StartFightPhase(), SmartAI::StopFollow(), SmartAI::StopPath(), CreatureAI::TriggerAlert(), Pet::Update(), TimedFleeingMovementGenerator::Update(), boss_onyxia::UpdateAI(), boss_grand_champion::boss_grand_championAI::UpdateAI(), boss_jormungarAI::UpdateAI(), boss_icehowl::boss_icehowlAI::UpdateAI(), npc_hor_lich_king::npc_hor_lich_kingAI::UpdateAI(), npc_kinetic_bomb::npc_kinetic_bombAI::UpdateAI(), boss_lord_marrowgar::UpdateAI(), boss_sindragosa::boss_sindragosaAI::UpdateAI(), npc_rimefang::npc_rimefangAI::UpdateAI(), npc_valithria_cloud::npc_valithria_cloudAI::UpdateAI(), boss_malygos::UpdateAI(), boss_stormcaller_brundir::UpdateAI(), boss_mimiron::UpdateAI(), boss_razorscale::UpdateAI(), boss_thorim_sif::UpdateAI(), npc_mature_netherwing_drake::npc_mature_netherwing_drakeAI::UpdateAI(), npc_pet_gen_plump_turkey::UpdateAI(), and PetAI::UpdateAI().

◆ StopMovingOnCurrentPos()

void Unit::StopMovingOnCurrentPos ( )
13176{
13178
13179 // not need send any packets if not in world
13180 if (!IsInWorld())
13181 return;
13182
13183 DisableSpline(); // pussywizard: required so Launch() won't recalculate position from previous spline
13184 Movement::MoveSplineInit init(this);
13185 init.MoveTo(GetPositionX(), GetPositionY(), GetPositionZ());
13186 init.SetFacing(GetOrientation());
13187 init.Launch();
13188}

References ClearUnitState(), DisableSpline(), Position::GetOrientation(), Position::GetPositionX(), Position::GetPositionY(), Position::GetPositionZ(), Object::IsInWorld(), Movement::MoveSplineInit::Launch(), Movement::MoveSplineInit::MoveTo(), Movement::MoveSplineInit::SetFacing(), and UNIT_STATE_MOVING.

Referenced by npc_high_overlord_saurfang_icc::npc_high_overlord_saurfangAI::DoAction(), npc_muradin_bronzebeard_icc::npc_muradin_bronzebeard_iccAI::DoAction(), brann_bronzebeard::brann_bronzebeardAI::DoAction(), boss_illidan_stormrage::DoAction(), npc_maiev_illidan::DoAction(), boss_alar::DoDiveBomb(), UtherBatteredHiltEvent::Execute(), WorldSession::HandlePetActionHelper(), npc_valkyr_shadowguard::npc_valkyr_shadowguardAI::HandleSpeedChangeIfNeeded(), boss_flame_leviathan::InitializeAI(), boss_prince_keleseth_icc::boss_prince_kelesethAI::JustDied(), boss_prince_taldaram_icc::boss_prince_taldaramAI::JustDied(), boss_prince_valanar_icc::boss_prince_valanarAI::JustDied(), boss_cyanigosa::boss_cyanigosaAI::JustDied(), boss_the_lich_king::boss_the_lich_kingAI::JustSummoned(), boss_algalon_the_observer::JustSummoned(), boss_icehowl::boss_icehowlAI::MovementInform(), npc_escortAI::MovementInform(), SmartAI::MovepointReached(), npc_ulduar_magnetic_core::npc_ulduar_magnetic_core(), instance_halls_of_reflection::instance_halls_of_reflection_InstanceMapScript::OnCreatureCreate(), instance_ulduar::instance_ulduar_InstanceMapScript::OnCreatureCreate(), boss_janalai::Reset(), npc_q24545_lich_king::npc_q24545_lich_kingAI::Reset(), boss_devourer_of_souls::boss_devourer_of_soulsAI::SpellHitTarget(), Creature::Update(), npc_rookery_hatcher::npc_rookery_hatcherAI::UpdateAI(), npc_vaelastrasz_the_red::npc_vaelastrasz_the_redAI::UpdateAI(), boss_jormungarAI::UpdateAI(), and npc_strangulate_vehicle::npc_strangulate_vehicleAI::UpdateAI().

◆ Talk() [1/2]

void Unit::Talk ( std::string_view  text,
ChatMsg  msgType,
Language  language,
float  textRange,
WorldObject const *  target 
)
virtual
17343{
17344 Acore::CustomChatTextBuilder builder(this, msgType, text, language, target);
17347 Cell::VisitObjects(this, worker, textRange);
17348}
Definition ChatTextBuilder.h:49
Definition GridNotifiers.h:1737
Definition GridNotifiers.h:583

References Cell::VisitObjects().

Referenced by spell_inoculate_nestlewood_owlkin::HandleEffectRemove(), and spell_the_flag_of_ownership::HandleScript().

◆ Talk() [2/2]

void Unit::Talk ( uint32  textId,
ChatMsg  msgType,
float  textRange,
WorldObject const *  target 
)
virtual
17395{
17396 if (!sObjectMgr->GetBroadcastText(textId))
17397 {
17398 LOG_ERROR("entities.unit", "Unit::Talk: `broadcast_text` (ID: {}) was not found", textId);
17399 return;
17400 }
17401
17402 Acore::BroadcastTextBuilder builder(this, msgType, textId, getGender(), target);
17405 Cell::VisitObjects(this, worker, textRange);
17406}
Definition ChatTextBuilder.h:31
uint8 getGender() const
Definition Unit.h:842

References getGender(), LOG_ERROR, sObjectMgr, and Cell::VisitObjects().

◆ TauntApply()

void Unit::TauntApply ( Unit victim)
11545{
11546 ASSERT(IsCreature());
11547
11548 if (!taunter || (taunter->IsPlayer() && taunter->ToPlayer()->IsGameMaster()))
11549 return;
11550
11551 if (!CanHaveThreatList())
11552 return;
11553
11554 Creature* creature = ToCreature();
11555
11556 if (creature->HasReactState(REACT_PASSIVE))
11557 return;
11558
11559 Unit* target = GetVictim();
11560 if (target && target == taunter)
11561 return;
11562
11563 SetInFront(taunter);
11564 SetGuidValue(UNIT_FIELD_TARGET, taunter->GetGUID());
11565
11566 if (creature->IsAIEnabled)
11567 creature->AI()->AttackStart(taunter);
11568
11569 //m_ThreatMgr.tauntApply(taunter);
11570}
void SetInFront(WorldObject const *target)
Definition Unit.cpp:16609

References Creature::AI(), ASSERT, UnitAI::AttackStart(), CanHaveThreatList(), Object::GetGUID(), GetVictim(), Creature::HasReactState(), IsAIEnabled, Object::IsCreature(), Player::IsGameMaster(), Object::IsPlayer(), REACT_PASSIVE, Object::SetGuidValue(), SetInFront(), Object::ToCreature(), Object::ToPlayer(), and UNIT_FIELD_TARGET.

Referenced by AuraEffect::HandleModTaunt(), and boss_razorgore::boss_razorgoreAI::OnCharmed().

◆ TauntFadeOut()

void Unit::TauntFadeOut ( Unit taunter)
11575{
11576 ASSERT(IsCreature());
11577
11578 if (!taunter || (taunter->IsPlayer() && taunter->ToPlayer()->IsGameMaster()))
11579 return;
11580
11581 if (!CanHaveThreatList())
11582 return;
11583
11584 Creature* creature = ToCreature();
11585
11586 if (creature->HasReactState(REACT_PASSIVE))
11587 return;
11588
11589 Unit* target = GetVictim();
11590 if (!target || target != taunter)
11591 return;
11592
11594 {
11595 if (creature->IsAIEnabled)
11597 return;
11598 }
11599
11600 target = creature->SelectVictim(); // might have more taunt auras remaining
11601
11602 if (target && target != taunter)
11603 {
11605 SetInFront(target);
11606 if (creature->IsAIEnabled)
11607 creature->AI()->AttackStart(target);
11608 }
11609}
@ EVADE_REASON_NO_HOSTILES
Definition CreatureAI.h:90
virtual void EnterEvadeMode(EvadeReason why=EVADE_REASON_OTHER)
Definition CreatureAI.cpp:205
Unit * SelectVictim()
Definition Unit.cpp:11613
bool isThreatListEmpty() const
Definition ThreatMgr.h:228

References Creature::AI(), ASSERT, UnitAI::AttackStart(), CanHaveThreatList(), CreatureAI::EnterEvadeMode(), CreatureAI::EVADE_REASON_NO_HOSTILES, Object::GetGUID(), GetVictim(), Creature::HasReactState(), IsAIEnabled, Object::IsCreature(), Player::IsGameMaster(), Object::IsPlayer(), ThreatMgr::isThreatListEmpty(), m_ThreatMgr, REACT_PASSIVE, Creature::SelectVictim(), Object::SetGuidValue(), SetInFront(), Object::ToCreature(), Object::ToPlayer(), and UNIT_FIELD_TARGET.

Referenced by AuraEffect::HandleModTaunt(), and npc_deaths_fel_cannon::npc_deaths_fel_cannonAI::UpdateAI().

◆ TextEmote() [1/2]

void Unit::TextEmote ( std::string_view  text,
WorldObject const *  target = nullptr,
bool  isBossEmote = false 
)
virtual

◆ TextEmote() [2/2]

void Unit::TextEmote ( uint32  textId,
WorldObject const *  target = nullptr,
bool  isBossEmote = false 
)
virtual

Reimplemented in Player.

17419{
17420 Talk(textId, isBossEmote ? CHAT_MSG_RAID_BOSS_EMOTE : CHAT_MSG_MONSTER_EMOTE, sWorld->getFloatConfig(CONFIG_LISTEN_RANGE_TEXTEMOTE), target);
17421}

References CHAT_MSG_MONSTER_EMOTE, CHAT_MSG_RAID_BOSS_EMOTE, CONFIG_LISTEN_RANGE_TEXTEMOTE, and sWorld.

◆ ToPet()

◆ ToTempSummon() [1/2]

TempSummon * Unit::ToTempSummon ( )
inline
725{ if (IsSummon()) return reinterpret_cast<TempSummon*>(this); else return nullptr; }

References IsSummon().

Referenced by CreatureAI::_EnterEvadeMode(), _ExitVehicle(), npc_living_mojo::npc_living_mojoAI::AttackStart(), WorldObject::CanSeeOrDetect(), Spell::CheckCast(), Spell::CheckEffectTarget(), npc_tiger_matriarch::npc_tiger_matriarchAI::DamageTaken(), Creature::DespawnOnEvade(), Creature::DespawnOrUnsummon(), npc_bone_spike::npc_bone_spikeAI::DoAction(), boss_sindragosa::boss_sindragosaAI::DoAction(), npc_strangulate_vehicle::npc_strangulate_vehicleAI::DoAction(), ThreatMgr::DoAddThreat(), Spell::EffectScriptEffect(), npc_phantom_hallucination::npc_phantom_hallucinationAI::EnterEvadeMode(), npc_marzon_silent_blade::npc_marzon_silent_bladeAI::EnterEvadeMode(), SuckBackEvent::Execute(), npc_raging_flames::FixateRandomTarget(), boss_headless_horseman_head::GetOwner(), GetSpellModOwner(), npc_infra_green_bomber_generic::npc_infra_green_bomber_genericAI::GetSummoner(), CreatureAI::GetSummoner(), Creature::GetSummonerGUID(), SmartScript::GetTargets(), WorldSession::HandleDismissCritter(), spell_pilgrims_bounty_pass_generic::HandleDummy(), WorldSession::HandlePetActionHelper(), spell_the_cleansing_on_death_cast_on_master::HandleScript(), spell_gen_whisper_to_controller::HandleScript(), spell_pri_lightwell::HandleScriptEffect(), spell_q11026_a11051_banish_the_demons::HandleScriptEffect(), npc_hourglass_of_eternity::npc_hourglass_of_eternityAI::InitializeAI(), npc_bushwhacker::npc_bushwhackerAI::InitializeAI(), npc_pet_gen_imp_in_a_bottle::InitializeAI(), npc_pet_pri_lightwell::InitializeAI(), TempSummon::InitStats(), SpellClickInfo::IsFitToRequirements(), Creature::IsUpdateNeeded(), npc_balance_of_light_and_shadow::npc_balance_of_light_and_shadowAI::JustDied(), boss_black_knight::boss_black_knightAI::JustDied(), boss_tyrannus::boss_tyrannusAI::JustDied(), npc_raging_spirit::npc_raging_spiritAI::JustDied(), boss_freya_iron_root::JustDied(), boss_yoggsaron_influence_tentacle::JustDied(), boss_essence_of_anger::boss_essence_of_angerAI::JustDied(), npc_pet_dk_ghoul::JustDied(), npc_marzon_silent_blade::npc_marzon_silent_bladeAI::JustEngagedWith(), boss_yoggsaron_cloud::JustSummoned(), npc_frosthound::JustSummoned(), boss_halion::boss_halionAI::JustSummoned(), boss_lady_deathwhisper::boss_lady_deathwhisperAI::JustSummoned(), npc_collapsing_star::JustSummoned(), npc_algalon_worm_hole::JustSummoned(), boss_supremus::JustSummoned(), Kill(), npc_tiger_matriarch::npc_tiger_matriarchAI::KilledUnit(), npc_netherspite_infernal::KilledUnit(), npc_living_mojo::npc_living_mojoAI::MoveInLineOfSight(), npc_jenny::MoveInLineOfSight(), WaypointMovementGenerator< Creature >::MovementInform(), npc_frostbrood_skytalon::npc_frostbrood_skytalonAI::MovementInform(), npc_injured_7th_legion_soldier::npc_injured_7th_legion_soldierAI::MovementInform(), npc_balance_of_light_and_shadow::npc_balance_of_light_and_shadowAI::MovementInform(), npc_marzon_silent_blade::npc_marzon_silent_bladeAI::MovementInform(), npc_attracted_reef_bull::npc_attracted_reef_bullAI::MovementInform(), npc_attracted_reef_bull::npc_attracted_reef_bullAI::npc_attracted_reef_bullAI(), npc_batrider::npc_batrider(), npc_claw_tentacle::npc_claw_tentacle(), npc_eye_tentacle::npc_eye_tentacle(), npc_giant_claw_tentacle::npc_giant_claw_tentacle(), npc_giant_eye_tentacle::npc_giant_eye_tentacle(), npc_midsummer_bonfire::npc_midsummer_bonfire(), npc_midsummer_ribbon_pole_target::npc_midsummer_ribbon_pole_target(), npc_pet_gen_soul_trader_beacon::npc_pet_gen_soul_trader_beacon(), BattlefieldWG::OnCreatureCreate(), instance_blackwing_lair::instance_blackwing_lair_InstanceMapScript::OnCreatureCreate(), npc_wormhole::OnGossipHello(), RemoveAllControlled(), RemoveAllMinionsByEntry(), spell_gen_defend::RemoveDummyFromDriver(), npc_raging_spirit::npc_raging_spiritAI::Reset(), npc_stormforged_lieutenant::Reset(), npc_future_you::npc_future_youAI::Reset(), npc_plaguehound_tracker::npc_plaguehound_trackerAI::Reset(), npc_voidtraveler::Reset(), npc_pet_gen_argent_pony_bridle::Reset(), Spell::SelectImplicitCasterObjectTargets(), Creature::SelectVictim(), Spell::SendSpellGo(), Spell::SendSpellStart(), npc_ulduar_flames_spread::SpellHit(), npc_pilgrims_bounty_plate::SpellHit(), boss_the_lich_king::boss_the_lich_kingAI::SummonedCreatureDies(), instance_icecrown_citadel::instance_icecrown_citadel_InstanceMapScript::Update(), npc_valkyr_battle_maiden::npc_valkyr_battle_maidenAI::UpdateAI(), npc_love_in_air_snivel_real::UpdateAI(), npc_tiger_matriarch_credit::npc_tiger_matriarch_creditAI::UpdateAI(), npc_tiger_matriarch::npc_tiger_matriarchAI::UpdateAI(), npc_living_mojo::npc_living_mojoAI::UpdateAI(), npc_bone_spike::npc_bone_spikeAI::UpdateAI(), npc_little_ooze::npc_little_oozeAI::UpdateAI(), npc_raging_spirit::npc_raging_spiritAI::UpdateAI(), npc_strangulate_vehicle::npc_strangulate_vehicleAI::UpdateAI(), npc_freya_ward::UpdateAI(), npc_ulduar_flash_freeze::UpdateAI(), npc_vh_void_sentry::npc_vh_void_sentryAI::UpdateAI(), npc_jenny::UpdateFollowerAI(), Player::VehicleSpellInitialize(), and npc_frosthound::WaypointReached().

◆ ToTempSummon() [2/2]

const TempSummon * Unit::ToTempSummon ( ) const
inline
726{ if (IsSummon()) return reinterpret_cast<const TempSummon*>(this); else return nullptr; }

References IsSummon().

◆ ToTotem()

Totem * Unit::ToTotem ( )
inline
724{ if (IsTotem()) return reinterpret_cast<Totem*>(this); else return nullptr; }
Definition Totem.h:51

References IsTotem().

Referenced by _UnapplyAura(), Spell::EffectDestroyAllTotems(), WorldSession::HandleTotemDestroyed(), SetMinion(), Spell::SummonGuardian(), and TotemAI::UpdateAI().

◆ TriggerAurasProcOnEvent() [1/3]

void Unit::TriggerAurasProcOnEvent ( CalcDamageInfo damageInfo)
13031{
13032 DamageInfo dmgInfo = DamageInfo(damageInfo);
13033 TriggerAurasProcOnEvent(nullptr, nullptr, damageInfo.target, damageInfo.procAttacker, damageInfo.procVictim, 0, 0, dmgInfo.GetHitMask(), nullptr, &dmgInfo, nullptr);
13034}
uint32 GetHitMask() const
Definition Unit.cpp:264

References DamageInfo::GetHitMask(), CalcDamageInfo::procAttacker, CalcDamageInfo::procVictim, CalcDamageInfo::target, and TriggerAurasProcOnEvent().

Referenced by ProcSkillsAndAuras(), TriggerAurasProcOnEvent(), and TriggerAurasProcOnEvent().

◆ TriggerAurasProcOnEvent() [2/3]

void Unit::TriggerAurasProcOnEvent ( ProcEventInfo eventInfo,
AuraApplicationProcContainer procAuras 
)
13056{
13057 for (auto const& [procEffectMask, aurApp] : aurasTriggeringProc)
13058 {
13059 if (!aurApp->GetRemoveMode())
13060 aurApp->GetBase()->TriggerProcOnEvent(procEffectMask, aurApp, eventInfo);
13061 }
13062}

◆ TriggerAurasProcOnEvent() [3/3]

void Unit::TriggerAurasProcOnEvent ( std::list< AuraApplication * > *  myProcAuras,
std::list< AuraApplication * > *  targetProcAuras,
Unit actionTarget,
uint32  typeMaskActor,
uint32  typeMaskActionTarget,
uint32  spellTypeMask,
uint32  spellPhaseMask,
uint32  hitMask,
Spell spell,
DamageInfo damageInfo,
HealInfo healInfo 
)
13037{
13038 // prepare data for self trigger
13039 ProcEventInfo myProcEventInfo = ProcEventInfo(this, actionTarget, actionTarget, typeMaskActor, spellTypeMask, spellPhaseMask, hitMask, spell, damageInfo, healInfo);
13040 AuraApplicationProcContainer myAurasTriggeringProc;
13041 GetProcAurasTriggeredOnEvent(myAurasTriggeringProc, myProcAuras, myProcEventInfo);
13042
13043 // prepare data for target trigger
13044 ProcEventInfo targetProcEventInfo = ProcEventInfo(this, actionTarget, this, typeMaskActionTarget, spellTypeMask, spellPhaseMask, hitMask, spell, damageInfo, healInfo);
13045 AuraApplicationProcContainer targetAurasTriggeringProc;
13046 if (typeMaskActionTarget && actionTarget)
13047 actionTarget->GetProcAurasTriggeredOnEvent(targetAurasTriggeringProc, targetProcAuras, targetProcEventInfo);
13048
13049 TriggerAurasProcOnEvent(myProcEventInfo, myAurasTriggeringProc);
13050
13051 if (typeMaskActionTarget && actionTarget)
13052 actionTarget->TriggerAurasProcOnEvent(targetProcEventInfo, targetAurasTriggeringProc);
13053}
Definition Unit.h:434
void GetProcAurasTriggeredOnEvent(AuraApplicationProcContainer &aurasTriggeringProc, std::list< AuraApplication * > *procAuras, ProcEventInfo eventInfo)
Definition Unit.cpp:12993
std::vector< std::pair< uint8, AuraApplication * > > AuraApplicationProcContainer
Definition Unit.h:677

References GetProcAurasTriggeredOnEvent(), spellTypeMask, and TriggerAurasProcOnEvent().

◆ UnsummonAllTotems()

void Unit::UnsummonAllTotems ( bool  onDeath = false)
8198{
8199 for (uint8 i = 0; i < MAX_SUMMON_SLOT; ++i)
8200 {
8201 if (!m_SummonSlot[i])
8202 {
8203 continue;
8204 }
8205
8206 if (Creature* OldTotem = GetMap()->GetCreature(m_SummonSlot[i]))
8207 {
8208 if (OldTotem->IsSummon())
8209 {
8210 if (!(onDeath && !IsPlayer() && OldTotem->IsGuardian()))
8211 {
8212 OldTotem->ToTempSummon()->UnSummon();
8213 }
8214 }
8215 }
8216 }
8217}

References WorldObject::GetMap(), Object::IsPlayer(), m_SummonSlot, and MAX_SUMMON_SLOT.

Referenced by Player::ActivateSpec(), RemoveFromWorld(), and setDeathState().

◆ Update()

void Unit::Update ( uint32  time)
overridevirtual

Reimplemented from WorldObject.

492{
493 sScriptMgr->OnUnitUpdate(this, p_time);
494
495 // WARNING! Order of execution here is important, do not change.
496 // Spells must be processed with event system BEFORE they go to _UpdateSpells.
497 // Or else we may have some SPELL_STATE_FINISHED spells stalled in pointers, that is bad.
498 WorldObject::Update(p_time);
499
500 if (!IsInWorld())
501 return;
502
503 // pussywizard:
504 if (!IsPlayer() || (!ToPlayer()->IsBeingTeleported() && !bRequestForcedVisibilityUpdate))
505 {
507 {
509 {
511 //ExecuteDelayedUnitRelocationEvent();
513 }
514 else
516 }
518 {
519 if (m_delayed_unit_ai_notify_timer <= p_time)
520 {
523 }
524 else
526 }
527 }
528
529 _UpdateSpells( p_time );
530
531 if (CanHaveThreatList() && GetThreatMgr().isNeedUpdateToClient(p_time))
533
534 // update combat timer only for players and pets (only pets with PetAI)
536 {
537 // Check UNIT_STATE_MELEE_ATTACKING or UNIT_STATE_CHASE (without UNIT_STATE_FOLLOW in this case) so pets can reach far away
538 // targets without stopping half way there and running off.
539 // These flags are reset after target dies or another command is given.
541 {
542 // m_CombatTimer set at aura start and it will be freeze until aura removing
543 if (m_CombatTimer <= p_time)
545 else
546 m_CombatTimer -= p_time;
547 }
548 }
549
552 {
553 while (!extraAttacksTargets.empty())
554 {
555 auto itr = extraAttacksTargets.begin();
556 ObjectGuid targetGuid = itr->first;
557 uint32 count = itr->second;
558 extraAttacksTargets.erase(itr);
559 if (Unit* victim = ObjectAccessor::GetUnit(*this, targetGuid))
560 {
562 || victim->IsWithinMeleeRange(this))
563 {
564 HandleProcExtraAttackFor(victim, count);
565 }
566 }
567 }
569 }
570
571 // not implemented before 3.0.2
572 // xinef: if attack time > 0, reduce by diff
573 // if on next update, attack time < 0 assume player didnt attack - set to 0
574 bool suspendAttackTimer = false;
575 bool suspendRangedAttackTimer = false;
577 {
578 for (Spell* spell : m_currentSpells)
579 {
580 if (spell)
581 {
582 if (spell->GetSpellInfo()->HasAttribute(SPELL_ATTR2_DO_NOT_RESET_COMBAT_TIMERS))
583 {
584 if (spell->IsChannelActive())
585 {
586 suspendRangedAttackTimer = true;
587 }
588
589 suspendAttackTimer = true;
590 break;
591 }
592 }
593 }
594 }
595
596 if (!suspendAttackTimer)
597 {
598 if (int32 base_attack = getAttackTimer(BASE_ATTACK))
599 {
600 setAttackTimer(BASE_ATTACK, base_attack > 0 ? base_attack - (int32) p_time : 0);
601 }
602
603 if (int32 off_attack = getAttackTimer(OFF_ATTACK))
604 {
605 setAttackTimer(OFF_ATTACK, off_attack > 0 ? off_attack - (int32) p_time : 0);
606 }
607 }
608
609 if (!suspendRangedAttackTimer)
610 {
611 if (int32 ranged_attack = getAttackTimer(RANGED_ATTACK))
612 {
613 setAttackTimer(RANGED_ATTACK, ranged_attack > 0 ? ranged_attack - (int32)p_time : 0);
614 }
615 }
616
617 // update abilities available only for fraction of time
618 UpdateReactives(p_time);
619
623
624 UpdateSplineMovement(p_time);
625 GetMotionMaster()->UpdateMotion(p_time);
626
628}
@ AURA_STATE_HEALTH_ABOVE_75_PERCENT
Definition SharedDefines.h:1326
@ SPELL_HACK_AND_SLASH
Definition Unit.h:299
@ SPELL_SWORD_SPECIALIZATION
Definition Unit.h:298
bool IsEmpty() const
Definition LinkedList.h:97
std::unordered_set< Unit * > i_objectsForDelayedVisibility
Definition Map.h:236
void UpdateMotion(uint32 diff)
Definition MotionMaster.cpp:105
void _UpdateSpells(uint32 time)
Definition Unit.cpp:3961
void UpdateSplineMovement(uint32 t_diff)
Definition Unit.cpp:684
void UpdateReactives(uint32 p_time)
Definition Unit.cpp:13442
void ExecuteDelayedUnitAINotifyEvent()
Definition Unit.cpp:16598
void HandleProcExtraAttackFor(Unit *victim, uint32 count)
Definition Unit.cpp:2888
void SendThreatListUpdate()
Definition Unit.cpp:16172
virtual void Update(uint32 diff)
Definition Object.cpp:1044

References _lastDamagedTargetGuid, _lastExtraAttackSpell, _UpdateSpells(), AURA_STATE_HEALTH_ABOVE_75_PERCENT, AURA_STATE_HEALTHLESS_20_PERCENT, AURA_STATE_HEALTHLESS_35_PERCENT, BASE_ATTACK, bRequestForcedVisibilityUpdate, CanHaveThreatList(), ClearInCombat(), ObjectGuid::Empty, ExecuteDelayedUnitAINotifyEvent(), extraAttacksTargets, WorldObject::FindMap(), getAttackTimer(), GetMotionMaster(), GetThreatMgr(), ObjectAccessor::GetUnit(), HandleProcExtraAttackFor(), HasUnitState(), HasUnitTypeMask(), HealthAbovePct(), HealthBelowPct(), Map::i_objectsForDelayedVisibility, InvalidateValuesUpdateCache(), IsAlive(), IsControlledByPlayer(), LinkedListHead::IsEmpty(), IsInCombat(), Object::IsInWorld(), IsPet(), Object::IsPlayer(), m_CombatTimer, m_currentSpells, m_delayed_unit_ai_notify_timer, m_delayed_unit_relocation_timer, m_HostileRefMgr, ModifyAuraState(), OFF_ATTACK, RANGED_ATTACK, SendThreatListUpdate(), setAttackTimer(), SPELL_ATTR2_DO_NOT_RESET_COMBAT_TIMERS, SPELL_HACK_AND_SLASH, SPELL_SWORD_SPECIALIZATION, sScriptMgr, Object::ToPlayer(), UNIT_MASK_CONTROLLABLE_GUARDIAN, UNIT_STATE_CASTING, WorldObject::Update(), MotionMaster::UpdateMotion(), UpdateReactives(), and UpdateSplineMovement().

Referenced by Creature::Update(), and Player::Update().

◆ UpdateAllDamageDoneMods()

void Unit::UpdateAllDamageDoneMods ( )
12272{
12273 for (uint8 i = BASE_ATTACK; i < MAX_ATTACK; ++i)
12275}
virtual void UpdateDamageDoneMods(WeaponAttackType attackType, int32 skipEnchantSlot=-1)
Definition Unit.cpp:12241

References BASE_ATTACK, MAX_ATTACK, and UpdateDamageDoneMods().

Referenced by AuraEffect::HandleModDamageDone().

◆ UpdateAllDamagePctDoneMods()

void Unit::UpdateAllDamagePctDoneMods ( )
12316{
12317 for (uint8 i = BASE_ATTACK; i < MAX_ATTACK; ++i)
12319}
void UpdateDamagePctDoneMods(WeaponAttackType attackType)
Definition Unit.cpp:12277

References BASE_ATTACK, MAX_ATTACK, and UpdateDamagePctDoneMods().

Referenced by AuraEffect::HandleModDamagePercentDone().

◆ UpdateAllResistances()

void Unit::UpdateAllResistances ( )
virtual

◆ UpdateAllStats()

virtual bool Unit::UpdateAllStats ( )
pure virtual

Implemented in Creature, Guardian, Player, and Totem.

◆ UpdateArmor()

virtual void Unit::UpdateArmor ( )
pure virtual

◆ UpdateAttackPowerAndDamage()

virtual void Unit::UpdateAttackPowerAndDamage ( bool  ranged = false)
pure virtual

Implemented in Creature, Guardian, Player, and Totem.

Referenced by UpdateUnitMod().

◆ UpdateAuraForGroup()

void Unit::UpdateAuraForGroup ( uint8  slot)
13684{
13685 if (slot >= MAX_AURAS) // slot not found, return
13686 return;
13687 if (Player* player = ToPlayer())
13688 {
13689 if (player->GetGroup())
13690 {
13691 player->SetGroupUpdateFlag(GROUP_UPDATE_FLAG_AURAS);
13692 player->SetAuraUpdateMaskForRaid(slot);
13693 }
13694 }
13695 else if (IsCreature() && IsPet())
13696 {
13697 Pet* pet = ((Pet*)this);
13698 if (pet->isControlled())
13699 {
13700 Unit* owner = GetOwner();
13701 if (owner && (owner->IsPlayer()) && owner->ToPlayer()->GetGroup())
13702 {
13704 pet->SetAuraUpdateMaskForRaid(slot);
13705 }
13706 }
13707 }
13708}
@ GROUP_UPDATE_FLAG_PET_AURAS
Definition Group.h:118
@ GROUP_UPDATE_FLAG_AURAS
Definition Group.h:109
#define MAX_AURAS
Definition SpellAuraDefines.h:21
void SetAuraUpdateMaskForRaid(uint8 slot)
Definition Pet.h:137

References Player::GetGroup(), GetOwner(), GROUP_UPDATE_FLAG_AURAS, GROUP_UPDATE_FLAG_PET_AURAS, Pet::isControlled(), Object::IsCreature(), IsPet(), Object::IsPlayer(), MAX_AURAS, Pet::SetAuraUpdateMaskForRaid(), Player::SetGroupUpdateFlag(), and Object::ToPlayer().

Referenced by RemoveVisibleAura(), and SetVisibleAura().

◆ UpdateCharmAI()

void Unit::UpdateCharmAI ( )
12781{
12782 if (IsPlayer())
12783 return;
12784
12785 if (i_disabledAI) // disabled AI must be primary AI
12786 {
12787 if (!IsCharmed())
12788 {
12789 delete i_AI;
12791 i_disabledAI = nullptr;
12792 }
12793 }
12794 else
12795 {
12796 if (IsCharmed())
12797 {
12799 if (isPossessed() || IsVehicle())
12800 i_AI = new PossessedAI(ToCreature());
12801 else
12802 i_AI = new PetAI(ToCreature());
12803 }
12804 }
12805}
Definition PetAI.h:47
Definition PassiveAI.h:37

References i_AI, i_disabledAI, IsCharmed(), Object::IsPlayer(), isPossessed(), IsVehicle(), and Object::ToCreature().

Referenced by Creature::Update().

◆ UpdateDamageDoneMods()

void Unit::UpdateDamageDoneMods ( WeaponAttackType  attackType,
int32  skipEnchantSlot = -1 
)
virtual

Reimplemented in Player.

12242{
12243 UnitMods unitMod;
12244 switch (attackType)
12245 {
12246 case BASE_ATTACK:
12247 unitMod = UNIT_MOD_DAMAGE_MAINHAND;
12248 break;
12249 case OFF_ATTACK:
12250 unitMod = UNIT_MOD_DAMAGE_OFFHAND;
12251 break;
12252 case RANGED_ATTACK:
12253 unitMod = UNIT_MOD_DAMAGE_RANGED;
12254 break;
12255 default:
12256 ABORT();
12257 break;
12258 }
12259
12260 float amount = GetTotalAuraModifier(SPELL_AURA_MOD_DAMAGE_DONE, [&](AuraEffect const* aurEff) -> bool
12261 {
12262 if (!(aurEff->GetMiscValue() & SPELL_SCHOOL_MASK_NORMAL))
12263 return false;
12264
12265 return CheckAttackFitToAuraRequirement(attackType, aurEff);
12266 });
12267
12268 SetStatFlatModifier(unitMod, TOTAL_VALUE, amount);
12269}
@ UNIT_MOD_DAMAGE_RANGED
Definition Unit.h:174
@ UNIT_MOD_DAMAGE_MAINHAND
Definition Unit.h:172
virtual bool CheckAttackFitToAuraRequirement(WeaponAttackType, AuraEffect const *) const
Definition Unit.h:1076
void SetStatFlatModifier(UnitMods unitMod, UnitModifierFlatType modifierType, float val)
Definition Unit.cpp:12138

References ABORT, BASE_ATTACK, CheckAttackFitToAuraRequirement(), AuraEffect::GetMiscValue(), GetTotalAuraModifier(), OFF_ATTACK, RANGED_ATTACK, SetStatFlatModifier(), SPELL_AURA_MOD_DAMAGE_DONE, SPELL_SCHOOL_MASK_NORMAL, TOTAL_VALUE, UNIT_MOD_DAMAGE_MAINHAND, UNIT_MOD_DAMAGE_OFFHAND, and UNIT_MOD_DAMAGE_RANGED.

Referenced by UpdateAllDamageDoneMods(), and Player::UpdateDamageDoneMods().

◆ UpdateDamagePctDoneMods()

void Unit::UpdateDamagePctDoneMods ( WeaponAttackType  attackType)
12278{
12279 float factor;
12280 UnitMods unitMod;
12281 switch (attackType)
12282 {
12283 case BASE_ATTACK:
12284 factor = 1.0f;
12285 unitMod = UNIT_MOD_DAMAGE_MAINHAND;
12286 break;
12287 case OFF_ATTACK:
12288 // off hand has 50% penalty
12289 factor = 0.5f;
12290 unitMod = UNIT_MOD_DAMAGE_OFFHAND;
12291 break;
12292 case RANGED_ATTACK:
12293 factor = 1.0f;
12294 unitMod = UNIT_MOD_DAMAGE_RANGED;
12295 break;
12296 default:
12297 ABORT();
12298 break;
12299 }
12300
12301 factor *= GetTotalAuraMultiplier(SPELL_AURA_MOD_DAMAGE_PERCENT_DONE, [attackType, this](AuraEffect const* aurEff) -> bool
12302 {
12303 if (!(aurEff->GetMiscValue() & SPELL_SCHOOL_MASK_NORMAL))
12304 return false;
12305
12306 return CheckAttackFitToAuraRequirement(attackType, aurEff);
12307 });
12308
12309 if (attackType == OFF_ATTACK)
12310 factor *= GetTotalAuraMultiplier(SPELL_AURA_MOD_OFFHAND_DAMAGE_PCT, std::bind(&Unit::CheckAttackFitToAuraRequirement, this, attackType, std::placeholders::_1));
12311
12312 SetStatPctModifier(unitMod, TOTAL_PCT, factor);
12313}
@ SPELL_AURA_MOD_OFFHAND_DAMAGE_PCT
Definition SpellAuraDefines.h:185
void SetStatPctModifier(UnitMods unitMod, UnitModifierPctType modifierType, float val)
Definition Unit.cpp:12147

References ABORT, BASE_ATTACK, CheckAttackFitToAuraRequirement(), AuraEffect::GetMiscValue(), GetTotalAuraMultiplier(), OFF_ATTACK, RANGED_ATTACK, SetStatPctModifier(), SPELL_AURA_MOD_DAMAGE_PERCENT_DONE, SPELL_AURA_MOD_OFFHAND_DAMAGE_PCT, SPELL_SCHOOL_MASK_NORMAL, TOTAL_PCT, UNIT_MOD_DAMAGE_MAINHAND, UNIT_MOD_DAMAGE_OFFHAND, and UNIT_MOD_DAMAGE_RANGED.

Referenced by AuraEffect::HandleModOffhandDamagePercent(), UpdateAllDamagePctDoneMods(), and Player::UpdateWeaponDependentAuras().

◆ UpdateDamagePhysical()

void Unit::UpdateDamagePhysical ( WeaponAttackType  attType)
virtual

Reimplemented in Guardian, and Totem.

61{
62 float totalMin = 0.f;
63 float totalMax = 0.f;
64
65 float tmpMin, tmpMax;
66 for (uint8 i = 0; i < MAX_ITEM_PROTO_DAMAGES; ++i)
67 {
68 CalculateMinMaxDamage(attType, false, true, tmpMin, tmpMax, i);
69 totalMin += tmpMin;
70 totalMax += tmpMax;
71 }
72
73 switch (attType)
74 {
75 case BASE_ATTACK:
76 default:
79 break;
80 case OFF_ATTACK:
83 break;
84 case RANGED_ATTACK:
87 break;
88 }
89}
void SetStatFloatValue(uint16 index, float value)
Definition Object.cpp:779

References BASE_ATTACK, CalculateMinMaxDamage(), MAX_ITEM_PROTO_DAMAGES, OFF_ATTACK, RANGED_ATTACK, Object::SetStatFloatValue(), UNIT_FIELD_MAXDAMAGE, UNIT_FIELD_MAXOFFHANDDAMAGE, UNIT_FIELD_MAXRANGEDDAMAGE, UNIT_FIELD_MINDAMAGE, UNIT_FIELD_MINOFFHANDDAMAGE, and UNIT_FIELD_MINRANGEDDAMAGE.

Referenced by Player::_ApplyAmmoBonuses(), Player::_ApplyWeaponDamage(), boss_twin_valkyrAI::boss_twin_valkyrAI(), AuraEffect::HandleAuraModDisarm(), AuraEffect::HandleModAttackSpeed(), npc_toc_enh_shaman::npc_toc_enh_shamanAI::npc_toc_enh_shamanAI(), Player::RemoveAmmo(), Creature::SetCanDualWield(), ScriptedAI::SetEquipmentSlots(), Creature::UpdateAttackPowerAndDamage(), Player::UpdateAttackPowerAndDamage(), and UpdateUnitMod().

◆ UpdateHeight()

void Unit::UpdateHeight ( float  newZ)

Only server-side height update, does not broadcast to client.

16166{
16168 if (IsVehicle())
16170}
void RelocatePassengers()
Definition Vehicle.cpp:517

References Position::GetPositionX(), Position::GetPositionY(), GetVehicleKit(), IsVehicle(), Position::Relocate(), and Vehicle::RelocatePassengers().

Referenced by npc_dancing_flames::npc_dancing_flamesAI::Reset().

◆ UpdateInterruptMask()

void Unit::UpdateInterruptMask ( )
877{
878 m_interruptMask = 0;
879 for (AuraApplicationList::const_iterator i = m_interruptableAuras.begin(); i != m_interruptableAuras.end(); ++i)
880 m_interruptMask |= (*i)->GetBase()->GetSpellInfo()->AuraInterruptFlags;
881
883 if (spell->getState() == SPELL_STATE_CASTING)
884 m_interruptMask |= spell->m_spellInfo->ChannelInterruptFlags;
885}

References CURRENT_CHANNELED_SPELL, m_currentSpells, m_interruptableAuras, m_interruptMask, and SPELL_STATE_CASTING.

Referenced by _UnapplyAura(), Spell::finish(), and RemoveAurasWithInterruptFlags().

◆ UpdateMaxHealth()

virtual void Unit::UpdateMaxHealth ( )
pure virtual

Implemented in Creature, Guardian, Player, and Totem.

Referenced by UpdateUnitMod().

◆ UpdateMaxPower()

virtual void Unit::UpdateMaxPower ( Powers  power)
pure virtual

Implemented in Creature, Guardian, Player, and Totem.

Referenced by UpdateUnitMod().

◆ UpdateObjectVisibility()

◆ UpdateOrientation()

void Unit::UpdateOrientation ( float  orientation)

Only server-side orientation update, does not broadcast to client.

16158{
16159 SetOrientation(orientation);
16160 if (IsVehicle())
16162}

References GetVehicleKit(), IsVehicle(), Vehicle::RelocatePassengers(), and Position::SetOrientation().

Referenced by Spell::UpdateChanneledTargetList(), and UpdatePosition().

◆ UpdatePosition() [1/2]

bool Unit::UpdatePosition ( const Position pos,
bool  teleport = false 
)
inline

◆ UpdatePosition() [2/2]

bool Unit::UpdatePosition ( float  x,
float  y,
float  z,
float  ang,
bool  teleport = false 
)
virtual

Reimplemented in Player.

16120{
16121 if (!Acore::IsValidMapCoord(x, y, z, orientation))
16122 return false;
16123
16124 float old_orientation = GetOrientation();
16125 float current_z = GetPositionZ();
16126 bool turn = (old_orientation != orientation);
16127 bool relocated = (teleport || GetPositionX() != x || GetPositionY() != y || current_z != z);
16128
16129 if (!GetVehicle())
16130 {
16131 uint32 mask = 0;
16132 if (turn) mask |= AURA_INTERRUPT_FLAG_TURNING;
16133 if (relocated) mask |= AURA_INTERRUPT_FLAG_MOVE;
16134 if (mask)
16136 }
16137
16138 if (relocated)
16139 {
16140 if (IsPlayer())
16141 GetMap()->PlayerRelocation(ToPlayer(), x, y, z, orientation);
16142 else
16143 GetMap()->CreatureRelocation(ToCreature(), x, y, z, orientation);
16144 }
16145 else if (turn)
16146 {
16147 UpdateOrientation(orientation);
16148
16149 if (IsPlayer() && ToPlayer()->GetFarSightDistance())
16151 }
16152
16153 return (relocated || turn);
16154}
void PlayerRelocation(Player *, float x, float y, float z, float o)
Definition Map.cpp:784
void CreatureRelocation(Creature *creature, float x, float y, float z, float o)
Definition Map.cpp:806
void UpdateOrientation(float orientation)
Only server-side orientation update, does not broadcast to client.
Definition Unit.cpp:16157
bool IsValidMapCoord(float c)
Definition GridDefines.h:210

References AURA_INTERRUPT_FLAG_MOVE, AURA_INTERRUPT_FLAG_TURNING, Map::CreatureRelocation(), WorldObject::GetMap(), Position::GetOrientation(), Position::GetPositionX(), Position::GetPositionY(), Position::GetPositionZ(), GetVehicle(), Object::IsPlayer(), Acore::IsValidMapCoord(), Map::PlayerRelocation(), RemoveAurasWithInterruptFlags(), Object::ToCreature(), Object::ToPlayer(), UpdateObjectVisibility(), and UpdateOrientation().

Referenced by boss_taldaram::DoAction(), npc_hor_spiritual_reflection::npc_hor_spiritual_reflectionAI::EnterEvadeMode(), UtherBatteredHiltEvent::Execute(), WorldSession::HandleMoverRelocation(), boss_flame_leviathan::InitializeAI(), boss_prince_keleseth_icc::boss_prince_kelesethAI::JustDied(), boss_prince_taldaram_icc::boss_prince_taldaramAI::JustDied(), boss_prince_valanar_icc::boss_prince_valanarAI::JustDied(), boss_cyanigosa::boss_cyanigosaAI::JustDied(), boss_the_lich_king::boss_the_lich_kingAI::JustSummoned(), boss_algalon_the_observer::JustSummoned(), boss_harbinger_skyriss::JustSummoned(), boss_icehowl::boss_icehowlAI::MovementInform(), NearTeleportTo(), npc_ulduar_magnetic_core::npc_ulduar_magnetic_core(), instance_halls_of_reflection::instance_halls_of_reflection_InstanceMapScript::OnCreatureCreate(), instance_culling_of_stratholme::instance_culling_of_stratholme_InstanceMapScript::Reposition(), instance_old_hillsbrad::instance_old_hillsbrad_InstanceMapScript::Reposition(), npc_imprisoned_beryl_sorcerer::npc_imprisoned_beryl_sorcererAI::Reset(), npc_q24545_lich_king::npc_q24545_lich_kingAI::Reset(), npc_escortAI::SetNextWaypoint(), npc_escortAI::SetNextWaypoint(), npc_frost_sphere::npc_frost_sphereAI::UpdateAI(), boss_jormungarAI::UpdateAI(), npc_strangulate_vehicle::npc_strangulate_vehicleAI::UpdateAI(), Player::UpdatePosition(), and UpdateSplinePosition().

◆ UpdateReactives()

void Unit::UpdateReactives ( uint32  p_time)
13443{
13444 for (uint8 i = 0; i < MAX_REACTIVE; ++i)
13445 {
13446 ReactiveType reactive = ReactiveType(i);
13447
13448 if (!m_reactiveTimer[reactive])
13449 continue;
13450
13451 if (m_reactiveTimer[reactive] <= p_time)
13452 {
13453 m_reactiveTimer[reactive] = 0;
13454
13455 switch (reactive)
13456 {
13457 case REACTIVE_DEFENSE:
13460 break;
13464 break;
13465 case REACTIVE_OVERPOWER:
13467 {
13469 }
13470 break;
13472 if (IsHunterPet())
13474 break;
13475 default:
13476 break;
13477 }
13478 }
13479 else
13480 {
13481 m_reactiveTimer[reactive] -= p_time;
13482 }
13483 }
13484}
ReactiveType
Definition Unit.h:612

References AURA_STATE_DEFENSE, AURA_STATE_HUNTER_PARRY, CLASS_CONTEXT_ABILITY_REACTIVE, CLASS_HUNTER, CLASS_WARRIOR, ClearComboPoints(), HasAuraState(), IsClass(), IsHunterPet(), m_reactiveTimer, MAX_REACTIVE, ModifyAuraState(), REACTIVE_DEFENSE, REACTIVE_HUNTER_PARRY, REACTIVE_OVERPOWER, and REACTIVE_WOLVERINE_BITE.

Referenced by Update().

◆ UpdateResistanceBuffModsMod()

void Unit::UpdateResistanceBuffModsMod ( SpellSchools  school)
6373{
6374 float modPos = 0.0f;
6375 float modNeg = 0.0f;
6376
6377 // these auras are always positive
6379 modPos += GetTotalAuraModifier(SPELL_AURA_MOD_RESISTANCE, [school](AuraEffect const* aurEff) -> bool
6380 {
6381 if ((aurEff->GetMiscValue() & (1 << school)) && aurEff->GetAmount() > 0)
6382 return true;
6383 return false;
6384 });
6385
6386 modNeg = GetTotalAuraModifier(SPELL_AURA_MOD_RESISTANCE, [school](AuraEffect const* aurEff) -> bool
6387 {
6388 if ((aurEff->GetMiscValue() & (1 << school)) && aurEff->GetAmount() < 0)
6389 return true;
6390 return false;
6391 });
6392
6394 modPos *= factor;
6395 modNeg *= factor;
6396
6399}
@ SPELL_AURA_MOD_RESISTANCE
Definition SpellAuraDefines.h:85
@ SPELL_AURA_MOD_RESISTANCE_EXCLUSIVE
Definition SpellAuraDefines.h:206
@ SPELL_AURA_MOD_RESISTANCE_PCT
Definition SpellAuraDefines.h:164

References AsUnderlyingType(), AuraEffect::GetAmount(), GetMaxPositiveAuraModifierByMiscMask(), AuraEffect::GetMiscValue(), GetTotalAuraModifier(), GetTotalAuraMultiplierByMiscMask(), Object::SetFloatValue(), SPELL_AURA_MOD_RESISTANCE, SPELL_AURA_MOD_RESISTANCE_EXCLUSIVE, SPELL_AURA_MOD_RESISTANCE_PCT, UNIT_FIELD_RESISTANCEBUFFMODSNEGATIVE, and UNIT_FIELD_RESISTANCEBUFFMODSPOSITIVE.

Referenced by AuraEffect::HandleAuraModResistance(), AuraEffect::HandleAuraModResistanceExclusive(), and AuraEffect::HandleModResistancePercent().

◆ UpdateResistances()

virtual void Unit::UpdateResistances ( uint32  school)
pure virtual

Implemented in Creature, Player, and Totem.

Referenced by UpdateAllResistances(), and UpdateUnitMod().

◆ UpdateSpeed()

void Unit::UpdateSpeed ( UnitMoveType  mtype,
bool  forced 
)
Todo:
possible affect only on MOVE_RUN
11190{
11191 int32 main_speed_mod = 0;
11192 float stack_bonus = 1.0f;
11193 float non_stack_bonus = 1.0f;
11194
11195 switch (mtype)
11196 {
11197 // Only apply debuffs
11198 case MOVE_FLIGHT_BACK:
11199 case MOVE_RUN_BACK:
11200 case MOVE_SWIM_BACK:
11201 case MOVE_WALK:
11202 break;
11203 case MOVE_RUN:
11204 {
11205 if (IsMounted()) // Use on mount auras
11206 {
11210 }
11211 else
11212 {
11216 }
11217 break;
11218 }
11219 case MOVE_SWIM:
11220 {
11221 // xinef: check for forced_speed_mod of sea turtle
11223 for (Unit::AuraEffectList::const_iterator itr = swimAuras.begin(); itr != swimAuras.end(); ++itr)
11224 {
11225 // xinef: sea turtle only, it is not affected by any increasing / decreasing effects
11226 if ((*itr)->GetId() == 64731 /*SPELL_SEA_TURTLE*/)
11227 {
11228 SetSpeed(mtype, AddPct(non_stack_bonus, (*itr)->GetAmount()), forced);
11229 return;
11230 }
11231 else if (
11232 // case: increase speed
11233 ((*itr)->GetAmount() > 0 && (*itr)->GetAmount() > main_speed_mod) ||
11234 // case: decrease speed
11235 ((*itr)->GetAmount() < 0 && (*itr)->GetAmount() < main_speed_mod)
11236 )
11237 {
11238 main_speed_mod = (*itr)->GetAmount();
11239 }
11240 }
11241 break;
11242 }
11243 case MOVE_FLIGHT:
11244 {
11245 if (IsCreature() && IsControlledByPlayer()) // not sure if good for pet
11246 {
11249
11250 // for some spells this mod is applied on vehicle owner
11251 int32 owner_speed_mod = 0;
11252
11253 if (Unit* owner = GetCharmer())
11254 owner_speed_mod = owner->GetMaxPositiveAuraModifier(SPELL_AURA_MOD_INCREASE_FLIGHT_SPEED);
11255
11256 main_speed_mod = std::max(main_speed_mod, owner_speed_mod);
11257 }
11258 else if (IsMounted())
11259 {
11263 }
11264 else // Use not mount (shapeshift for example) auras (should stack)
11265 {
11269 }
11270
11271 // Update speed for vehicle if available
11272 if (IsPlayer() && GetVehicle())
11274 break;
11275 }
11276 default:
11277 LOG_ERROR("entities.unit", "Unit::UpdateSpeed: Unsupported move type ({})", mtype);
11278 return;
11279 }
11280
11281 // now we ready for speed calculation
11282 float speed = std::max(non_stack_bonus, stack_bonus);
11283 if (main_speed_mod)
11284 AddPct(speed, main_speed_mod);
11285
11286 switch (mtype)
11287 {
11288 case MOVE_RUN:
11289 case MOVE_SWIM:
11290 case MOVE_FLIGHT:
11291 {
11292 // Set creature speed rate
11293 if (IsCreature())
11294 {
11295 if (IsPet() && ToPet()->isControlled() && IsControlledByPlayer())
11296 {
11297 // contant value for player pets
11298 speed *= 1.15f;
11299 }
11300 else
11301 {
11302 speed *= ToCreature()->GetCreatureTemplate()->speed_run; // at this point, MOVE_WALK is never reached
11303 }
11304 }
11305
11306 // Normalize speed by 191 aura SPELL_AURA_USE_NORMAL_MOVEMENT_SPEED if need
11309 {
11310 if (Creature* creature = ToCreature())
11311 {
11312 uint32 immuneMask = creature->GetCreatureTemplate()->MechanicImmuneMask;
11313 if (immuneMask & (1 << (MECHANIC_SNARE - 1)) || immuneMask & (1 << (MECHANIC_DAZE - 1)))
11314 break;
11315 }
11316
11317 // Use speed from aura
11318 float max_speed = normalization / (IsControlledByPlayer() ? playerBaseMoveSpeed[mtype] : baseMoveSpeed[mtype]);
11319 if (speed > max_speed)
11320 speed = max_speed;
11321 }
11322 break;
11323 }
11324 default:
11325 break;
11326 }
11327
11328 int32 slowFromHealth = 0;
11329 Creature* creature = ToCreature();
11330 // ignore pets, player owned vehicles, and mobs immune to snare
11331 if (creature
11332 && !IsPet()
11333 && !(IsControlledByPlayer() && IsVehicle())
11335 && !(creature->IsDungeonBoss()))
11336 {
11337 // 1.6% for each % under 30.
11338 // use min(0, health-30) so that we don't boost mobs above 30.
11339 slowFromHealth = (int32) std::min(0.0f, (1.66f * (GetHealthPct() - 30.0f)));
11340 }
11341
11342 if (slowFromHealth)
11343 {
11344 AddPct(speed, slowFromHealth);
11345 }
11346
11347 // Apply strongest slow aura mod to speed
11349 if (slow)
11350 AddPct(speed, slow);
11351
11352 if (float minSpeedMod = (float)GetMaxPositiveAuraModifier(SPELL_AURA_MOD_MINIMUM_SPEED))
11353 {
11354 float base_speed = (IsCreature() ? ToCreature()->GetCreatureTemplate()->speed_run : 1.0f);
11355 float min_speed = base_speed * (minSpeedMod / 100.0f);
11356 if (speed < min_speed)
11357 speed = min_speed;
11358 }
11359
11360 SetSpeed(mtype, speed, forced);
11361}
@ MECHANIC_DAZE
Definition SharedDefines.h:1363
@ SPELL_AURA_MOD_INCREASE_FLIGHT_SPEED
Definition SpellAuraDefines.h:269
@ SPELL_AURA_MOD_MOUNTED_FLIGHT_SPEED_ALWAYS
Definition SpellAuraDefines.h:272
@ SPELL_AURA_MOD_INCREASE_SPEED
Definition SpellAuraDefines.h:94
@ SPELL_AURA_MOD_FLIGHT_SPEED_ALWAYS
Definition SpellAuraDefines.h:271
@ SPELL_AURA_MOD_MOUNTED_SPEED_NOT_STACK
Definition SpellAuraDefines.h:235
@ SPELL_AURA_MOD_SPEED_NOT_STACK
Definition SpellAuraDefines.h:234
@ SPELL_AURA_MOD_FLIGHT_SPEED_NOT_STACKING
Definition SpellAuraDefines.h:273
@ SPELL_AURA_MOD_INCREASE_SWIM_SPEED
Definition SpellAuraDefines.h:121
@ SPELL_AURA_MOD_MINIMUM_SPEED
Definition SpellAuraDefines.h:368
@ SPELL_AURA_MOD_SPEED_ALWAYS
Definition SpellAuraDefines.h:192
@ SPELL_AURA_MOD_FLIGHT_SPEED_MOUNTED_NOT_STACKING
Definition SpellAuraDefines.h:274
@ SPELL_AURA_MOD_MOUNTED_SPEED_ALWAYS
Definition SpellAuraDefines.h:193
@ SPELL_AURA_USE_NORMAL_MOVEMENT_SPEED
Definition SpellAuraDefines.h:254
@ MOVE_FLIGHT_BACK
Definition UnitDefines.h:360
@ MOVE_SWIM_BACK
Definition UnitDefines.h:357
@ MOVE_RUN_BACK
Definition UnitDefines.h:355
@ MOVE_WALK
Definition UnitDefines.h:353
bool HasMechanicTemplateImmunity(uint32 mask) const
Definition Creature.cpp:2166
void SetSpeed(UnitMoveType mtype, float rate, bool forced=false)
Definition Unit.cpp:11368
float speed_run
Definition CreatureData.h:201

References AddPct(), baseMoveSpeed, GetAuraEffectsByType(), GetCharmer(), Creature::GetCreatureTemplate(), GetHealthPct(), GetMaxNegativeAuraModifier(), GetMaxPositiveAuraModifier(), GetTotalAuraModifier(), GetTotalAuraMultiplier(), GetVehicle(), GetVehicleBase(), Creature::HasMechanicTemplateImmunity(), IsControlledByPlayer(), Object::IsCreature(), Creature::IsDungeonBoss(), IsMounted(), IsPet(), Object::IsPlayer(), IsVehicle(), LOG_ERROR, MECHANIC_DAZE, MECHANIC_SNARE, MOVE_FLIGHT, MOVE_FLIGHT_BACK, MOVE_RUN, MOVE_RUN_BACK, MOVE_SWIM, MOVE_SWIM_BACK, MOVE_WALK, playerBaseMoveSpeed, SetSpeed(), CreatureTemplate::speed_run, SPELL_AURA_MOD_DECREASE_SPEED, SPELL_AURA_MOD_FLIGHT_SPEED_ALWAYS, SPELL_AURA_MOD_FLIGHT_SPEED_MOUNTED_NOT_STACKING, SPELL_AURA_MOD_FLIGHT_SPEED_NOT_STACKING, SPELL_AURA_MOD_INCREASE_FLIGHT_SPEED, SPELL_AURA_MOD_INCREASE_MOUNTED_FLIGHT_SPEED, SPELL_AURA_MOD_INCREASE_MOUNTED_SPEED, SPELL_AURA_MOD_INCREASE_SPEED, SPELL_AURA_MOD_INCREASE_SWIM_SPEED, SPELL_AURA_MOD_MINIMUM_SPEED, SPELL_AURA_MOD_MOUNTED_FLIGHT_SPEED_ALWAYS, SPELL_AURA_MOD_MOUNTED_SPEED_ALWAYS, SPELL_AURA_MOD_MOUNTED_SPEED_NOT_STACK, SPELL_AURA_MOD_SPEED_ALWAYS, SPELL_AURA_MOD_SPEED_NOT_STACK, SPELL_AURA_USE_NORMAL_MOVEMENT_SPEED, Object::ToCreature(), ToPet(), and UpdateSpeed().

Referenced by Creature::DoFleeToGetAssistance(), AuraEffect::HandleAuraModDecreaseSpeed(), AuraEffect::HandleAuraModIncreaseFlightSpeed(), AuraEffect::HandleAuraModIncreaseSpeed(), AuraEffect::HandleAuraModIncreaseSwimSpeed(), AuraEffect::HandleAuraModUseNormalSpeed(), spell_brewfest_main_ram_buff::HandleEffectPeriodic(), RemoveCharmedBy(), SetHealth(), SetInCombatState(), SetSpeed(), and UpdateSpeed().

◆ UpdateSplineMovement()

void Unit::UpdateSplineMovement ( uint32  t_diff)
private
685{
686 if (movespline->Finalized())
687 return;
688
689 // xinef: process movementinform
690 // this code cant be placed inside EscortMovementGenerator, because we cant delete active MoveGen while it is updated
691 SplineHandler handler(this);
692 movespline->updateState(t_diff, handler);
693 // Xinef: Spline was cleared by StopMoving, return
694 if (!movespline->Initialized())
695 {
697 return;
698 }
699
700 bool arrived = movespline->Finalized();
701
702 if (arrived)
703 {
705
706 if (movespline->HasAnimation() && IsCreature() && IsAlive())
708 }
709
710 // pussywizard: update always! not every 400ms, because movement generators need the actual position
711 //m_movesplineTimer.Update(t_diff);
712 //if (m_movesplineTimer.Passed() || arrived)
714}
AnimTier
Definition MotionMaster.h:99
uint8 GetAnimationType() const
Definition MoveSpline.h:125
void updateState(int32 difftime, UpdateHandler &handler)
Definition MoveSpline.h:98
bool HasAnimation() const
Definition MoveSpline.h:124
Definition Unit.cpp:664
void SetAnimTier(AnimTier animTier)
Definition Unit.cpp:12062

References DisableSpline(), Movement::MoveSpline::Finalized(), Movement::MoveSpline::GetAnimationType(), Movement::MoveSpline::HasAnimation(), Movement::MoveSpline::Initialized(), IsAlive(), Object::IsCreature(), movespline, SetAnimTier(), UpdateSplinePosition(), and Movement::MoveSpline::updateState().

Referenced by Update().

◆ UpdateSplinePosition()

void Unit::UpdateSplinePosition ( )
private
717{
718 //static uint32 const positionUpdateDelay = 400;
719
720 //m_movesplineTimer.Reset(positionUpdateDelay);
722
724 {
726 pos.m_positionX = loc.x;
727 pos.m_positionY = loc.y;
728 pos.m_positionZ = loc.z;
730
731 if (TransportBase* transport = GetDirectTransport())
732 transport->CalculatePassengerPosition(loc.x, loc.y, loc.z, &loc.orientation);
733 }
734
735 // Xinef: if we had spline running update orientation along with position
736 //if (HasUnitState(UNIT_STATE_CANNOT_TURN))
737 // loc.orientation = GetOrientation();
738
739 if (IsPlayer() || IsPet())
740 UpdatePosition(loc.x, loc.y, loc.z, loc.orientation);
741 else
742 ToCreature()->SetPosition(loc.x, loc.y, loc.z, loc.orientation);
743}
void SetPosition(float x, float y, float z, float o)
Definition Creature.cpp:3115
Location ComputePosition() const
Definition MoveSpline.cpp:26
bool onTransport
Definition MoveSpline.h:127
Definition VehicleDefines.h:130
TransportBase * GetDirectTransport() const
Definition Unit.cpp:15133
Position pos
Definition Object.h:308
Definition MoveSpline.h:27
float orientation
Definition MoveSpline.h:33
float m_positionZ
Definition Position.h:57
float m_positionX
Definition Position.h:55
float m_positionY
Definition Position.h:56

References Movement::MoveSpline::ComputePosition(), GetDirectTransport(), IsPet(), Object::IsPlayer(), WorldObject::m_movementInfo, Position::m_positionX, Position::m_positionY, Position::m_positionZ, movespline, Movement::MoveSpline::onTransport, Movement::Location::orientation, MovementInfo::TransportInfo::pos, Position::SetOrientation(), Creature::SetPosition(), Object::ToCreature(), MovementInfo::transport, and UpdatePosition().

Referenced by StopMoving(), and UpdateSplineMovement().

◆ UpdateStatBuffMod()

void Unit::UpdateStatBuffMod ( Stats  stat)
6402{
6403 float modPos = 0.0f;
6404 float modNeg = 0.0f;
6405 float factor = 0.0f;
6406
6407 UnitMods const unitMod = static_cast<UnitMods>(UNIT_MOD_STAT_START + AsUnderlyingType(stat));
6408
6409 // includes value from items and enchantments
6410 float modValue = GetFlatModifierValue(unitMod, BASE_VALUE);
6411 if (modValue > 0.f)
6412 modPos += modValue;
6413 else
6414 modNeg += modValue;
6415
6416 modPos += GetTotalAuraModifier(SPELL_AURA_MOD_STAT, [stat](AuraEffect const* aurEff) -> bool
6417 {
6418 if ((aurEff->GetMiscValue() < 0 || aurEff->GetMiscValue() == stat) && aurEff->GetAmount() > 0)
6419 return true;
6420 return false;
6421 });
6422
6423 modNeg += GetTotalAuraModifier(SPELL_AURA_MOD_STAT, [stat](AuraEffect const* aurEff) -> bool
6424 {
6425 if ((aurEff->GetMiscValue() < 0 || aurEff->GetMiscValue() == stat) && aurEff->GetAmount() < 0)
6426 return true;
6427 return false;
6428 });
6429
6430 factor = GetTotalAuraMultiplier(SPELL_AURA_MOD_PERCENT_STAT, [stat](AuraEffect const* aurEff) -> bool
6431 {
6432 if (aurEff->GetMiscValue() == -1 || aurEff->GetMiscValue() == stat)
6433 return true;
6434 return false;
6435 });
6436
6437 factor *= GetTotalAuraMultiplier(SPELL_AURA_MOD_TOTAL_STAT_PERCENTAGE, [stat](AuraEffect const* aurEff) -> bool
6438 {
6439 if (aurEff->GetMiscValue() == -1 || aurEff->GetMiscValue() == stat)
6440 return true;
6441 return false;
6442 });
6443
6444 modPos *= factor;
6445 modNeg *= factor;
6446
6449}
@ SPELL_AURA_MOD_TOTAL_STAT_PERCENTAGE
Definition SpellAuraDefines.h:200
@ SPELL_AURA_MOD_STAT
Definition SpellAuraDefines.h:92
@ SPELL_AURA_MOD_PERCENT_STAT
Definition SpellAuraDefines.h:143

References AsUnderlyingType(), BASE_VALUE, AuraEffect::GetAmount(), GetFlatModifierValue(), AuraEffect::GetMiscValue(), GetTotalAuraModifier(), GetTotalAuraMultiplier(), Object::SetFloatValue(), SPELL_AURA_MOD_PERCENT_STAT, SPELL_AURA_MOD_STAT, SPELL_AURA_MOD_TOTAL_STAT_PERCENTAGE, UNIT_FIELD_NEGSTAT0, UNIT_FIELD_POSSTAT0, and UNIT_MOD_STAT_START.

Referenced by Player::_ApplyItemBonuses(), Player::ApplyEnchantment(), AuraEffect::HandleAuraModStat(), and AuraEffect::HandleModTotalPercentStat().

◆ UpdateStats()

virtual bool Unit::UpdateStats ( Stats  stat)
pure virtual

Implemented in Creature, Guardian, Player, and Totem.

Referenced by UpdateUnitMod().

◆ UpdateUnitMod()

void Unit::UpdateUnitMod ( UnitMods  unitMod)
12179{
12180 if (!CanModifyStats())
12181 return;
12182
12183 switch (unitMod)
12184 {
12191 break;
12192
12193 case UNIT_MOD_ARMOR:
12194 UpdateArmor();
12195 break;
12196 case UNIT_MOD_HEALTH:
12198 break;
12199
12200 case UNIT_MOD_MANA:
12201 case UNIT_MOD_RAGE:
12202 case UNIT_MOD_FOCUS:
12203 case UNIT_MOD_ENERGY:
12204 case UNIT_MOD_HAPPINESS:
12205 case UNIT_MOD_RUNE:
12208 break;
12209
12217 break;
12218
12221 break;
12224 break;
12225
12228 break;
12231 break;
12234 break;
12235
12236 default:
12237 break;
12238 }
12239}
@ UNIT_MOD_ARMOR
Definition Unit.h:163
@ UNIT_MOD_ATTACK_POWER
Definition Unit.h:170
@ UNIT_MOD_HEALTH
Definition Unit.h:155
@ UNIT_MOD_ATTACK_POWER_RANGED
Definition Unit.h:171
SpellSchools GetSpellSchoolByAuraGroup(UnitMods unitMod) const
Definition Unit.cpp:12355
Stats GetStatByAuraGroup(UnitMods unitMod) const
Definition Unit.cpp:12387
virtual void UpdateAttackPowerAndDamage(bool ranged=false)=0
Powers GetPowerTypeByAuraGroup(UnitMods unitMod) const
Definition Unit.cpp:12416
virtual void UpdateDamagePhysical(WeaponAttackType attType)
Definition StatSystem.cpp:60
virtual void UpdateArmor()=0
virtual void UpdateMaxPower(Powers power)=0
virtual bool UpdateStats(Stats stat)=0
bool CanModifyStats() const
Definition Unit.h:1087
virtual void UpdateMaxHealth()=0

References BASE_ATTACK, CanModifyStats(), GetPowerTypeByAuraGroup(), GetSpellSchoolByAuraGroup(), GetStatByAuraGroup(), OFF_ATTACK, RANGED_ATTACK, UNIT_MOD_ARMOR, UNIT_MOD_ATTACK_POWER, UNIT_MOD_ATTACK_POWER_RANGED, UNIT_MOD_DAMAGE_MAINHAND, UNIT_MOD_DAMAGE_OFFHAND, UNIT_MOD_DAMAGE_RANGED, UNIT_MOD_ENERGY, UNIT_MOD_FOCUS, UNIT_MOD_HAPPINESS, UNIT_MOD_HEALTH, UNIT_MOD_MANA, UNIT_MOD_RAGE, UNIT_MOD_RESISTANCE_ARCANE, UNIT_MOD_RESISTANCE_FIRE, UNIT_MOD_RESISTANCE_FROST, UNIT_MOD_RESISTANCE_HOLY, UNIT_MOD_RESISTANCE_NATURE, UNIT_MOD_RESISTANCE_SHADOW, UNIT_MOD_RUNE, UNIT_MOD_RUNIC_POWER, UNIT_MOD_STAT_AGILITY, UNIT_MOD_STAT_INTELLECT, UNIT_MOD_STAT_SPIRIT, UNIT_MOD_STAT_STAMINA, UNIT_MOD_STAT_STRENGTH, UpdateArmor(), UpdateAttackPowerAndDamage(), UpdateDamagePhysical(), UpdateMaxHealth(), UpdateMaxPower(), UpdateResistances(), and UpdateStats().

Referenced by ApplyStatPctModifier(), HandleStatFlatModifier(), SetStatFlatModifier(), and SetStatPctModifier().

◆ Whisper() [1/2]

void Unit::Whisper ( std::string_view  text,
Language  language,
Player target,
bool  isBossWhisper = false 
)
virtual

Reimplemented in Player.

17366{
17367 if (!target)
17368 {
17369 return;
17370 }
17371
17373 WorldPacket data;
17374 ChatHandler::BuildChatPacket(data, isBossWhisper ? CHAT_MSG_RAID_BOSS_WHISPER : CHAT_MSG_MONSTER_WHISPER, language, this, target, text, 0, "", locale);
17375 target->SendDirectMessage(&data);
17376}
LocaleConstant
Definition Common.h:117
@ CHAT_MSG_MONSTER_WHISPER
Definition SharedDefines.h:3407
@ CHAT_MSG_RAID_BOSS_WHISPER
Definition SharedDefines.h:3434
static std::size_t BuildChatPacket(WorldPacket &data, ChatMsg chatType, Language language, ObjectGuid senderGUID, ObjectGuid receiverGUID, std::string_view message, uint8 chatTag, std::string const &senderName="", std::string const &receiverName="", uint32 achievementId=0, bool gmMessage=false, std::string const &channelName="")
Definition Chat.cpp:265
LocaleConstant GetSessionDbLocaleIndex() const
Definition WorldSession.h:579

References ChatHandler::BuildChatPacket(), CHAT_MSG_MONSTER_WHISPER, CHAT_MSG_RAID_BOSS_WHISPER, Player::GetSession(), WorldSession::GetSessionDbLocaleIndex(), and Player::SendDirectMessage().

Referenced by npc_commandscript::HandleNpcWhisperCommand(), spell_lich_king_whisper::HandleScript(), Map::ScriptsProcess(), and boss_zuramat::boss_zuramatAI::UpdateAI().

◆ Whisper() [2/2]

void Unit::Whisper ( uint32  textId,
Player target,
bool  isBossWhisper = false 
)
virtual

Reimplemented in Player.

17424{
17425 if (!target)
17426 {
17427 return;
17428 }
17429
17430 BroadcastText const* bct = sObjectMgr->GetBroadcastText(textId);
17431 if (!bct)
17432 {
17433 LOG_ERROR("entities.unit", "Unit::Whisper: `broadcast_text` was not {} found", textId);
17434 return;
17435 }
17436
17438 WorldPacket data;
17439 ChatHandler::BuildChatPacket(data, isBossWhisper ? CHAT_MSG_RAID_BOSS_WHISPER : CHAT_MSG_MONSTER_WHISPER, LANG_UNIVERSAL, this, target, bct->GetText(locale, getGender()), 0, "", locale);
17440 target->SendDirectMessage(&data);
17441}
Definition ObjectMgr.h:435

References ChatHandler::BuildChatPacket(), CHAT_MSG_MONSTER_WHISPER, CHAT_MSG_RAID_BOSS_WHISPER, getGender(), Player::GetSession(), WorldSession::GetSessionDbLocaleIndex(), BroadcastText::GetText(), LANG_UNIVERSAL, LOG_ERROR, Player::SendDirectMessage(), and sObjectMgr.

◆ Yell() [1/2]

void Unit::Yell ( std::string_view  text,
Language  language,
WorldObject const *  target = nullptr 
)
virtual

◆ Yell() [2/2]

void Unit::Yell ( uint32  textId,
WorldObject const *  target = nullptr 
)
virtual

Reimplemented in Player.

17414{
17415 Talk(textId, CHAT_MSG_MONSTER_YELL, sWorld->getFloatConfig(CONFIG_LISTEN_RANGE_YELL), target);
17416}

References CHAT_MSG_MONSTER_YELL, CONFIG_LISTEN_RANGE_YELL, and sWorld.

Member Data Documentation

◆ _charmThreatInfo

CharmThreatMap Unit::_charmThreatInfo
protected

Referenced by RemoveCharmedBy().

◆ _dualWieldMode

◆ _instantCast

bool Unit::_instantCast
protected

◆ _isWalkingBeforeCharm

bool Unit::_isWalkingBeforeCharm
private

Are we walking before we were charmed?

Referenced by SetCharm(), and Unit().

◆ _lastDamagedTargetGuid

◆ _lastExtraAttackSpell

uint32 Unit::_lastExtraAttackSpell
private

◆ _lastLiquid

LiquidTypeEntry const* Unit::_lastLiquid
protected

◆ _oldFactionId

uint32 Unit::_oldFactionId
private

faction before charm

Referenced by GetOldFactionId(), RemoveCharmedBy(), SetCharmedBy(), and Unit().

◆ _redirectThreatInfo

◆ _valuesUpdateCache

ValuesUpdateCache Unit::_valuesUpdateCache
private

◆ bRequestForcedVisibilityUpdate

◆ extraAttacksTargets

std::unordered_map<ObjectGuid , uint32 > Unit::extraAttacksTargets
private

Referenced by AddExtraAttacks(), and Update().

◆ i_AI

◆ i_disabledAI

UnitAI* Unit::i_disabledAI
protected

Referenced by UpdateCharmAI().

◆ i_motionMaster

MotionMaster* Unit::i_motionMaster
protected

◆ IsAIEnabled

◆ m_appliedAuras

◆ m_applyResilience

bool Unit::m_applyResilience
protected

◆ m_attackers

◆ m_attacking

Unit* Unit::m_attacking
protected

◆ m_attackTimer

◆ m_auraFlatModifiersGroup

float Unit::m_auraFlatModifiersGroup[UNIT_MOD_END][MODIFIER_TYPE_FLAT_END]
protected

◆ m_auraPctModifiersGroup

float Unit::m_auraPctModifiersGroup[UNIT_MOD_END][MODIFIER_TYPE_PCT_END]
protected

◆ m_auraStateAuras

◆ m_auraUpdateIterator

AuraMap::iterator Unit::m_auraUpdateIterator
protected

◆ m_AutoRepeatFirstCast

bool Unit::m_AutoRepeatFirstCast
protected

◆ m_baseSpellCritChance

◆ m_canModifyStats

bool Unit::m_canModifyStats
protected

◆ m_charmInfo

◆ m_cleanupDone

bool Unit::m_cleanupDone
private

◆ m_CombatTimer

uint32 Unit::m_CombatTimer
private

◆ m_ComboPointHolders

std::unordered_set<Unit*> Unit::m_ComboPointHolders
private

◆ m_comboPoints

int8 Unit::m_comboPoints
private

◆ m_comboTarget

◆ m_Controlled

◆ m_ControlledByPlayer

bool Unit::m_ControlledByPlayer

◆ m_CreatedByPlayer

bool Unit::m_CreatedByPlayer

◆ m_createStats

float Unit::m_createStats[MAX_STATS]
protected

◆ m_currentSpells

◆ m_deathState

◆ m_delayed_unit_ai_notify_timer

uint16 Unit::m_delayed_unit_ai_notify_timer

Referenced by Unit(), and Update().

◆ m_delayed_unit_relocation_timer

uint16 Unit::m_delayed_unit_relocation_timer

Referenced by Unit(), Player::Update(), and Update().

◆ m_Diminishing

◆ m_duringRemoveFromWorld

bool Unit::m_duringRemoveFromWorld
private

◆ m_dynObj

◆ m_extraAttacks

uint32 Unit::m_extraAttacks

◆ m_FollowingRefMgr

FollowerRefMgr Unit::m_FollowingRefMgr
private

Referenced by addFollower().

◆ m_gameObj

◆ m_HostileRefMgr

HostileRefMgr Unit::m_HostileRefMgr
private

◆ m_interruptableAuras

◆ m_interruptMask

◆ m_last_notify_mstime

uint32 Unit::m_last_notify_mstime

Referenced by Unit().

◆ m_last_notify_position

◆ m_lastManaUse

uint32 Unit::m_lastManaUse
private

◆ m_lastSanctuaryTime

uint32 Unit::m_lastSanctuaryTime

◆ m_modAttackSpeedPct

◆ m_modAuras

◆ m_modMeleeHitChance

◆ m_modRangedHitChance

◆ m_modSpellHitChance

◆ m_movedByPlayer

◆ m_ObjectSlot

◆ m_ownedAuras

◆ m_petAuras

PetAuraSet Unit::m_petAuras

◆ m_procDeep

int32 Unit::m_procDeep
protected

Referenced by CanProc(), and SetCantProc().

◆ m_race

uint8 Unit::m_race
protected

◆ m_reactiveTimer

uint32 Unit::m_reactiveTimer[MAX_REACTIVE]
protected

◆ m_realRace

uint8 Unit::m_realRace
protected

◆ m_regenTimer

◆ m_removedAuras

AuraList Unit::m_removedAuras
protected

◆ m_removedAurasCount

◆ m_scAuras

AuraList Unit::m_scAuras
protected

◆ m_sharedVision

◆ m_speed_rate

float Unit::m_speed_rate[MAX_MOVE_TYPE]
protected

◆ m_spellImmune

◆ m_state

uint32 Unit::m_state
private

◆ m_SummonSlot

◆ m_ThreatMgr

◆ m_threatModifier

float Unit::m_threatModifier[MAX_SPELL_SCHOOL]

◆ m_transform

uint32 Unit::m_transform
protected

Referenced by getTransForm(), setTransForm(), and Unit().

◆ m_unitTypeMask

◆ m_vehicle

◆ m_vehicleKit

Vehicle* Unit::m_vehicleKit
protected

◆ m_visibleAuras

◆ m_weaponDamage

◆ movespline

◆ NeedChangeAI

bool Unit::NeedChangeAI

◆ SafeUnitPointerSet

std::set<SafeUnitPointer*> Unit::SafeUnitPointerSet

The documentation for this class was generated from the following files: